Avatar for the swc-project user
swc-project
swc
BlogDocsChangelog

Performance History

Latest Results

perf(es/minifier): Apply pending substitutions in batch for if-dense statement lists The optimizer flushed pending substitutions into each `if` statement individually before `merge_similar_ifs` (one Finalizer + one NormalMultiReplacer walk per `if`). On typescript.js this produced ~68k double walks per optimize() call with 0.4-1.7% hit rates. Apply the substitutions to the whole statement list in a single batch walk when the list is if-dense (>= 16 ifs), and keep the per-if loop otherwise. Both forms are semantically equivalent: the substitution maps only mutate via consumption of applied entries, which happens in the same statement order either way. es/minifier/libs benchmarks: 2.5-13.8% faster across all 12 lib fixtures (typescript -13.8%, echarts -11.8%, lodash -10.5%), byte-identical output on the entire fixture corpus.
hamidrezahanafi:perf/minifier-batch-substitutions
37 minutes ago
fix(es/minifier): Preserve top-level declarations referenced only by direct eval (#12029) ## Description The DCE tree-shaker protects declarations reachable by a direct `eval` only within function scopes (added in #4693). `found_direct_eval` is propagated to the root scope, but `visit_mut_module` / `visit_mut_script` never consumed it, so top-level declarations referenced only through a direct `eval` were dropped — the `eval` then observes a missing binding at runtime. This consumes `found_direct_eval` at the root: when a direct `eval` reaches the root scope, the root-scope declarations are pinned so DCE cannot remove them. "Root-scope" means the module/script's own bindings — immediate top-level declarations (var/fn/class + imports) plus `var`s hoisted out of nested top-level statements — collected **without** descending into nested function scopes, so a top-level `eval` doesn't pin bindings it can't resolve. Each is pinned both as a graph entry (so `subtract_cycles` never subtracts it across Repeat passes — this covers reachable class cycles) and marked used (this covers lone bindings that have no in-graph references). Localized to the two root entry points; the added work only runs when a direct `eval` reaches the root scope, so it should be performance-neutral. Regression tests added to `simplify_dce` (each fails without the fix): a top-level `var`, a top-level class cycle, a top-level binding referenced by a nested `eval`, and a `var` hoisted out of a top-level block. Scope note: an `eval` inside an unreachable (dead) nested function still pins the enclosing top-level declarations, matching the existing function-scope behavior since #4693, which likewise doesn't gate on reachability. This only ever over-preserves, which is safe. ## Related issue Fixes #12028
main
10 hours ago
refactor(es/ast)!: use Function for object accessors
refactor/ast-object-get-set
11 hours ago
refactor(es/ast)!: use Function for object accessors
refactor/ast-object-get-set
12 hours ago
refactor(es/ast)!: use Function for object accessors
refactor/ast-object-get-set
12 hours ago
refactor(es/ast)!: use Function for object accessors
refactor/ast-object-get-set
12 hours ago
chore: Add changeset
refactor/ast-object-get-set
15 hours ago

Latest Branches

CodSpeed Performance Gauge
0%
perf(es/minifier): Apply pending substitutions in batch for if-dense statement lists#12079
41 minutes ago
85c8c60
hamidrezahanafi:perf/minifier-batch-substitutions
CodSpeed Performance Gauge
+1%
refactor(es/ast)!: use Function for object accessors#12077
12 hours ago
21951b3
refactor/ast-object-get-set
CodSpeed Performance Gauge
0%
fix(es/decorators): Avoid class state leakage for nested undecorated classes#12076
19 hours ago
a2584a5
fix/issue-12074
© 2026 CodSpeed Technology
Home Terms Privacy Docs