Reuse verified default font maps and streamline capacity scans
This commit is contained in:
1 parent
7707cd9b09
commit
d9143ddbd1
5 files changed
+137
-38
No files matched your search
@@ -1389,20 +1389,27 @@ impl Default for State {
|
||||
impl State {
|
||||
pub(super) fn collect_statistics(&self, c: &mut super::statistics::Collector) {
|
||||
use super::statistics::Ownership::Active;
|
||||
for b in self.boxes.values() {
|
||||
c.native_box(b, Active);
|
||||
}
|
||||
if c.material_only() {
|
||||
for saved in self.groups.iter().flat_map(|group| group.saved.values()) {
|
||||
if let Saved::Box(Some(b)) = saved {
|
||||
c.native_box(b, Active);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
c.usage.state.command_entries = self.commands.len();
|
||||
c.usage.state.control_name_bytes = self
|
||||
.commands
|
||||
.keys()
|
||||
.map(|n| match n {
|
||||
CommandName::Control(n) => n.len(),
|
||||
_ => 0,
|
||||
})
|
||||
.sum();
|
||||
c.usage.state.macro_bindings = self
|
||||
.commands
|
||||
.values()
|
||||
.filter(|m| matches!(m, Meaning::Macro(_)))
|
||||
.count();
|
||||
for (name, meaning) in &self.commands {
|
||||
if let CommandName::Control(name) = name {
|
||||
c.usage.state.control_name_bytes += name.len();
|
||||
}
|
||||
if let Meaning::Macro(macro_definition) = meaning {
|
||||
c.usage.state.macro_bindings += 1;
|
||||
c.macro_body(macro_definition);
|
||||
}
|
||||
}
|
||||
c.usage.state.token_registers = self.toks.len() + self.xe_inter_char_tokens.len();
|
||||
c.usage.state.parameter_entries =
|
||||
self.parameters.len() + self.token_parameters.len() + self.job_parameters.len();
|
||||
@@ -1428,20 +1435,12 @@ impl State {
|
||||
c.usage.state.hyphenation_trie_nodes = nodes;
|
||||
c.usage.state.hyphenation_edges = edges;
|
||||
c.usage.state.pattern_weight_cells = weights;
|
||||
for m in self.commands.values() {
|
||||
if let Meaning::Macro(m) = m {
|
||||
c.macro_body(m);
|
||||
}
|
||||
}
|
||||
for v in self.toks.values() {
|
||||
c.usage.token_list_cells += v.len();
|
||||
}
|
||||
for v in self.token_parameters.values().chain(self.xe_inter_char_tokens.values()) {
|
||||
c.shared_tokens(v);
|
||||
}
|
||||
for b in self.boxes.values() {
|
||||
c.native_box(b, Active);
|
||||
}
|
||||
for m in self.split_marks.values() {
|
||||
c.shared_tokens(&m.first);
|
||||
c.shared_tokens(&m.bottom);
|
||||
|
||||
@@ -162,6 +162,10 @@ impl Collector {
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn material_only(&self) -> bool {
|
||||
self.shared_lists.is_some()
|
||||
}
|
||||
|
||||
pub fn macro_body(&mut self, m: &Arc<Macro>) {
|
||||
if self.macros.insert(Arc::as_ptr(m) as usize) {
|
||||
self.usage.unique_macro_bodies += 1;
|
||||
|
||||
Reference in new issue
Block a user