Skip to content

Commit db465a6

Browse files
perf(javascript): keep collapse_vars' state in one object per nesting depth
terser's `collapse` keeps its scan in function-scoped `var`s that its closures share across candidates, and `collapseFrom` built those 25 closures, two transformers, a walker per candidate and a transformer per fold on every call: 37,201 calls and 86 MB per minify of typescript.js. The state now lives in a `CollapseState` held per nesting depth, the helpers are module-level functions handed it, and the scanners, the left-value walker, the remover and the left-value map are built once per state.
1 parent ab4d0e6 commit db465a6

1 file changed

Lines changed: 1010 additions & 854 deletions

File tree

0 commit comments

Comments
 (0)