perf: derive block modules from the first extracted runtime in buildChunkGraph#21166
Conversation
…hunkGraph visitModules re-extracted the full block-modules structure once per runtime, although only the merged active states of the connection groups can differ between runtimes. Other runtimes now derive their result from the first extraction and share the tuple arrays when all states are equal. Module ordinals are also assigned lazily so availability masks stay smaller. https://claude.ai/code/session_011i3b2EB3ProyAhsNiAdY8S
🦋 Changeset detectedLatest commit: b602979 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
This PR is packaged and the instant preview is available (6e52971). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@6e52971
yarn add -D webpack@https://pkg.pr.new/webpack@6e52971
pnpm add -D webpack@https://pkg.pr.new/webpack@6e52971 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #21166 +/- ##
=======================================
Coverage 92.37% 92.37%
=======================================
Files 581 581
Lines 63533 63559 +26
Branches 17606 17613 +7
=======================================
+ Hits 58686 58715 +29
+ Misses 4847 4844 -3
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 degrade performance by 31.85%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Memory | benchmark "asset-modules-inline", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
217.4 KB | 1,292 KB | -83.17% |
| ⚡ | Memory | benchmark "side-effects-reexport", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' |
1,193.1 KB | 767.1 KB | +55.53% |
| ⚡ | Memory | benchmark "devtool-eval", scenario '{"name":"mode-production","mode":"production"}' |
7.8 MB | 6.5 MB | +20.93% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing perf/build-chunk-graph-derive-block-modules (b602979) with main (30b18a6)
|
The CodSpeed memory regression on Generated by Claude Code |
Summary
visitModulesre-extracted the full block-modules structure once per runtime, although only the merged active states of the connection groups can differ between runtimes; other runtimes now derive their result from the first extraction and share the tuple arrays when all states are equal, and module ordinals are assigned lazily so availability masks stay smaller. On an 8-entry benchmark this makesbuildChunkGraph~26% faster with ~31% less allocation, with byte-identical chunk graph output and no overhead for single-runtime builds.What kind of change does this PR introduce?
perf
Did you add tests for your changes?
No new tests — behavior is unchanged (verified chunk-graph output is identical in development and production builds) and covered by the existing
ConfigTestCases,StatsTestCasesandTestCasessuites, which pass.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
Use of AI
This change was developed with Claude Code under human direction: the AI analyzed the hot path, implemented the change, and validated it with before/after benchmarks, chunk-graph equivalence digests, and the existing test suites.
https://claude.ai/code/session_011i3b2EB3ProyAhsNiAdY8S
Generated by Claude Code