From bd1f5daf2a809cfc445d11143572f9aa4e4a507a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 2 Dec 2026 16:22:28 -0800 Subject: [PATCH] Type Tools: reserve only the old run count in Make Numbers Sequence replace_runs reserved old.len() + 2 * changes.len() runs. For 2,000 numbers that is 4,001 runs on every preview change, while push merges neighbors with equal style and the output usually keeps about old.len() runs. The vector now starts at old.len() and grows when formatting splits a run. This changes only the initial allocation, so no test can fail without it; the existing long-text and styled-output tests still pass. --- crates/engine/src/cmd/addons/typetools/numbers.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/addons/typetools/numbers.rs b/crates/engine/src/cmd/addons/typetools/numbers.rs index 2db74afbfb..fb4306ddd5 100644 --- a/crates/engine/src/cmd/addons/typetools/numbers.rs +++ b/crates/engine/src/cmd/addons/typetools/numbers.rs @@ -336,7 +336,7 @@ pub(crate) fn apply(t: &mut TextObject, changes: &[Edit]) { fn replace_runs(runs: &mut Vec, changes: &[Edit]) { note_text_pass(); let old = std::mem::take(runs); - let mut out: Vec = Vec::with_capacity(old.len() + 2 * changes.len()); + let mut out: Vec = Vec::with_capacity(old.len()); let mut pending = changes.iter().rev().peekable(); // Where the run starts and where the last replaced range ends. let (mut off, mut cut) = (0, 0);