perf(ChunkGraph): track ownership of module runtime requirements instead of cloning#21140
Conversation
…ead of cloning Store the runtime requirements Set by reference when ownership is not transferred and copy lazily (copy-on-write) only if a later merge needs to mutate a shared Set, avoiding an eager clone on the cached rebuild path.
|
This PR is packaged and the instant preview is available (fa28e4a). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@fa28e4a
yarn add -D webpack@https://pkg.pr.new/webpack@fa28e4a
pnpm add -D webpack@https://pkg.pr.new/webpack@fa28e4a |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #21140 +/- ##
==========================================
- Coverage 92.36% 92.33% -0.03%
==========================================
Files 581 581
Lines 63244 63268 +24
Branches 17489 17495 +6
==========================================
+ Hits 58414 58421 +7
- Misses 4830 4847 +17
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will improve performance by 98.99%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Memory | benchmark "many-modules-commonjs", scenario '{"name":"mode-development","mode":"development"}' |
1,833.1 KB | 921.2 KB | +98.99% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing claude/todos-exclude-webpack-6-tzqghi (7364a3a) with main (996ce20)
Footnotes
-
18 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. ↩
Store the runtime requirements Set by reference when ownership is not
transferred and copy lazily (copy-on-write) only if a later merge needs
to mutate a shared Set, avoiding an eager clone on the cached rebuild path.