Skip to content

perf: parallelize code splitting chunk group walks#14759

Draft
JSerFeng wants to merge 1 commit into
mainfrom
perf/parallel-code-splitting
Draft

perf: parallelize code splitting chunk group walks#14759
JSerFeng wants to merge 1 commit into
mainfrom
perf/parallel-code-splitting

Conversation

@JSerFeng

Copy link
Copy Markdown
Contributor

Summary

  • prepare runtime-specific connection states once, then walk independent chunk groups with Rayon
  • validate availability, runtime, chunk mask, and topology revisions before accepting worker results
  • batch ChunkGraph, ChunkGroup, and ModuleGraph updates to reduce repeated lookup and allocation overhead
  • enable the optimized path by default while keeping RSPACK_EXPERIMENTAL_PARALLEL_CODE_SPLITTING=0 as a process-level fallback
  • add a wide code-splitting benchmark with 128 independent chunk groups

Performance

The wide Rspack benchmark improved from 89.948 ms to 71.654 ms (-20.3%). In the Arco Pro production benchmark, buildChunkGraph.process queue improved from 2.616 ms to 1.967 ms (-24.8%), while total build time remained effectively unchanged because this stage is a small part of the build.

A 1-thread control measured 71.608 ms versus 71.654 ms with 8 threads, so the measured gain currently comes primarily from batched commits and avoided repeated work; these workloads do not yet demonstrate thread-count scaling.

The CLI build and complete unit suite pass with the optimized path enabled by default. The explicit fallback path also passes the Rspack core unit tests. Workspace-wide Clippy remains blocked by the existing rkyv 0.7/0.8 PortablePath mismatch; Clippy passes for rspack_core and rspack_benchmark.

@github-actions

Copy link
Copy Markdown
Contributor

⏳ Triggered benchmark: Open

@github-actions

Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing c41936f to chore(deps): update dependency webpack-sources to v3.5.1 (#14750) by renovate[bot]

❌ Size increased by 56.00KB from 66.50MB to 66.56MB (⬆️0.08%)

@codspeed-hq

codspeed-hq Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will improve performance by 2.27%

⚡ 1 improved benchmark
✅ 42 untouched benchmarks
🆕 1 new benchmark
⏩ 47 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation rust@create_module_hashes 8.5 ms 8.3 ms +2.27%
🆕 Simulation rust@build_chunk_graph_wide N/A 20.3 ms N/A

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 perf/parallel-code-splitting (c41936f) with main (cd0781d)

Open in CodSpeed

Footnotes

  1. 47 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant