Repository navigation
perf(css): cut allocations and repeated work in the CSS minifier - #22830
Conversation
…ites again for an opt-in option
…arens only around a doubled pair
…er its value is one component
|
|
This PR is packaged and the instant preview of its latest commit is available. Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@22830
yarn add -D webpack@https://pkg.pr.new/webpack@22830
pnpm add -D webpack@https://pkg.pr.new/webpack@22830 |
Types CoverageCoverage after merging perf/css-next into main will be
Coverage Report |
Generated code sizeComparing base (
Read 1 asset(s) changed size, test untouched
No runtime gained or lost a runtime module. Built |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Change: Refactor Merge Risk: ⚪ Minimal · up to
|
Merging this PR will degrade performance by 4.54%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Memory | benchmark "html-many-chunks", scenario '{"name":"mode-development","mode":"development"}' |
1 MB | 1.5 MB | -31.86% |
| ⚡ | Memory | benchmark "wasm-modules-async", scenario '{"name":"mode-development","mode":"development"}' |
552.8 KB | 413.4 KB | +33.72% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing perf/css-next (bb0c011) with main (c28d144)
Footnotes
-
497 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
-
124 benchmarks were run, but are now archived. If they were deleted in another branch, consider rebasing to remove them from the report. Instead if they were added back, click here to restore them. ↩
Summary
Speeds up CSS minification. The output is unchanged: it is byte-identical to
mainon all 6630 outputs checked withtooling/hash-css-outputs.js.length = 0free it each time._orderMatters, which takes two property names, capped at 32k entries.:is()when none holds anis(;@supportsparentheses when the text has no((;Setto order a selector list that is already in order.Measured with
cssMinifyover theyarn benchmark:css-toolscorpus. Each fixture ran in a fresh process, best of 2 rounds, summed over all fixtures. Geomean is per fixture.mainmainAllocation per corpus pass went from 1252 MB to 1221 MB.
What kind of change does this PR introduce?
perf
Did you add tests for your changes?
Yes, in
test/unitCases/css/syntax.unittest.js:Does this PR introduce a breaking change?
No
If relevant, what needs to be documented once your changes are merged or what have you already documented?
n/a. The pending changeset
300-faster-minifier-startup.md("Speed up startup and CSS minification…") already covers this.Use of AI
Written with Claude Code (Claude). It profiled the minifier and wrote the changes and tests. It checked each change for byte-identical output across the corpus and measured each one's CPU and wall time against its parent commit.
Generated by Claude Code
Summary by CodeRabbit
Bug Fixes
Tests