swc minifier can hit exponential memory: 40 modules ballooned past 40GB in Next.js build
Vjeux · x · 2026-10-13
- Christopher Chedeau (Vjeux) used AI to find and fix an swc minifier bug: minifying a chain of constants where each uses the two previous ones takes Fibonacci-like time and memory.
- Bundlers produce this shape when scope-hoisting modules; a chain of 40 such modules in a Next.js production build grew past 40GB.
- Root cause: replaceseqassignment copies a multi-use variable's initializer into each use when istriviallit accepts it, and istriviallit accepted any tree of binary operators over literals regardless of size, so copies cascade within one mergesequencesinexprs call.
- Fix PR #12521 bounds literal expressions copied by the sequential inliner.
More from coding & agent
- Daily Codex user rips Codex Cloud as 'completely useless' after Grok one-shots the same task — zeeg · 2026-10-13
- OpenAI's Dots in real use: one user manages 2 PCs and 3 Codex cloud agents with it — noahsolomon · 2026-10-13
- How do you permanently stop an AI agent from narrating everything it does? — RachelVT42 · 2026-10-13
- Workflow: Using Claude Opus 5.5 to edit videos — nail the first 15s, then iterate — dotey · 2026-10-13
- Should agents have personas? Developers debate generalist agents vs role-based design — amankhan · 2026-10-13
- Jev-like Decision Models Spark a Wave of Papers: Papers with Code Roundup — zainhas · 2026-10-13