perf: reduce code splitter allocation and lookup overhead#13968
Conversation
📦 Binary Size-limit
🎉 Size decreased by 16.00KB from 61.92MB to 61.90MB (⬇️0.03%) |
Merging this PR will improve performance by 11.87%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Simulation | rust@build_chunk_graph |
80.6 ms | 72 ms | +11.87% |
Comparing codex/optimize-code-splitter-prepare (d2f4080) with main (eae2abd)2
Footnotes
-
25 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. ↩
-
No successful run was found on
main(4e0ad16) during the generation of this report, so eae2abd was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
Rsdoctor Bundle Diff Analysis
Found 6 projects in monorepo, 0 projects with changes. 📊 Quick Summary
Generated by Rsdoctor GitHub Action |
|
📝 Benchmark detail: Open
Base persistent cache hit rate:
|
00d375f to
783f718
Compare
There was a problem hiding this comment.
Pull request overview
This PR focuses on reducing allocations and repeated module-graph work during chunk graph/code splitting preparation, aiming to improve overall compilation performance in rspack_core.
Changes:
- Preallocates several hot-path
Vec/HashMapstructures to reduce reallocation overhead. - Refactors prepared connection/block mapping construction in the code splitter
prepare()path. - Adds queue preallocation support to
assign_depthsand adjusts depth-map initialization strategy.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| crates/rspack_plugin_esm_library/src/optimize_chunks.rs | Preallocates maps/vectors used for dynamic-import chunk short-name assignment. |
| crates/rspack_core/src/compilation/mod.rs | Updates assign_depths to support preallocating its BFS queue (but changes the public signature). |
| crates/rspack_core/src/compilation/build_chunk_graph/code_splitter.rs | Refactors prepared connection/block maps and reduces some per-module graph lookup/allocation overhead. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
📝 Benchmark detail: Open
Base persistent cache hit rate:
|
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
IndexMapwith vector-backed grouped connections and building the async block map directly from modules and module graph blocks.Related links
N/A
Checklist