Skip to content

Commit 6b4377d

Browse files
Boshenclaude
andcommitted
perf(minifier): use Vec::with_capacity for inline template expressions
Pre-allocate the Vec based on the number of expressions to avoid incremental reallocations. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent e62524d commit 6b4377d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crates/oxc_minifier/src/peephole/fold_constants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ impl<'a> PeepholeOptimizations {
724724
return;
725725
}
726726

727-
let mut inline_exprs = Vec::new();
727+
let mut inline_exprs = Vec::with_capacity(t.expressions.len());
728728
let new_exprs =
729729
ctx.ast.vec_from_iter(t.expressions.drain(..).enumerate().filter_map(|(idx, expr)| {
730730
if expr.may_have_side_effects(ctx) {

0 commit comments

Comments
 (0)