You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Chunk allocation currently uses process-wide keys and separate hash tables for Chunk values and graph relationships. Centralizing ownership makes graph-local array indexing possible while preserving identity across deletion, slot reuse, and incremental snapshot restoration.
Changes
Make ChunkGraph own and allocate Chunks and topology together. Route creation, removal, splitting, plugin hooks, HMR, and temporary module-execution graphs through the shared ownership model.
Represent ChunkUkey as a reusable slot index plus a checked, process-wide nonzero identity. Use array-backed ChunkSlotMap tables, validate complete keys, and preserve identities when cloning graph snapshots.
Add preallocated ChunkMap / ChunkSet working containers for CodeSplitter masks, SplitChunks indices, chunk-combination lookup, runtime requirements, and current-pass worksets. Keep historical caches and sparse collections hash-based; preserve explicit semantic ordering.
Preserve JavaScript Compilation ownership checks and use lossless process-local diagnostic references. Update architecture documentation and add dedicated Rust integration tests.
Adapt existing benchmarks to the ownership API without adding benchmark cases.
Validation
Built the native binding and dedicated Rust test artifacts before running tests.
Existing local CodSpeed walltime comparisons are available here. These isolate the latest working-table migration, not the full PR against main. React build, SplitChunks, and full hash showed no significant change. Runtime requirements varied from 16.29 ms to 15.59 ms against a 15.92 ms baseline on repeat, so no stable gain is claimed. PR CodSpeed results will be used to evaluate the full change and guide further optimization.
Tradeoffs
Keys grow to eight bytes. Array traversal and allocation scale with the slot high-water mark, including holes; sparse and historical collections retain HashMap/HashSet storage. The identity counter deliberately fails on exhaustion rather than wrapping. Incremental pass and cache invalidation rules remain in effect.
⚠️Note: The latest commit (f07788809426ce8ad36c435207ce7b0fd5943d45) does not have baseline artifacts. Using commit d4cd073db21483ed7c524dedf59ad1d8bf400b8e for baseline comparison instead. If this seems incorrect, please wait a few minutes and try rerunning the workflow.
Found 5 projects in monorepo, 0 projects with changes.
No successful run was found on main (f077888) during the generation of this report, so d4cd073 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Chunk allocation currently uses process-wide keys and separate hash tables for Chunk values and graph relationships. Centralizing ownership makes graph-local array indexing possible while preserving identity across deletion, slot reuse, and incremental snapshot restoration.
Changes
ChunkGraphown and allocate Chunks and topology together. Route creation, removal, splitting, plugin hooks, HMR, and temporary module-execution graphs through the shared ownership model.ChunkUkeyas a reusable slot index plus a checked, process-wide nonzero identity. Use array-backedChunkSlotMaptables, validate complete keys, and preserve identities when cloning graph snapshots.ChunkMap/ChunkSetworking containers for CodeSplitter masks, SplitChunks indices, chunk-combination lookup, runtime requirements, and current-pass worksets. Keep historical caches and sparse collections hash-based; preserve explicit semantic ordering.Validation
cargo test -p rspack_core_test: 13 passed.cargo fmt --all --check,git diff --check, and commit formatting/spelling hooks passed.Tradeoffs
Keys grow to eight bytes. Array traversal and allocation scale with the slot high-water mark, including holes; sparse and historical collections retain HashMap/HashSet storage. The identity counter deliberately fails on exhaustion rather than wrapping. Incremental pass and cache invalidation rules remain in effect.