Skip to content

perf: split-chunks cache group matching#13646

Draft
LingyuCoder wants to merge 1 commit intomainfrom
codex/split-chunks-cache-group-pruning
Draft

perf: split-chunks cache group matching#13646
LingyuCoder wants to merge 1 commit intomainfrom
codex/split-chunks-cache-group-pruning

Conversation

@LingyuCoder
Copy link
Copy Markdown
Contributor

Summary

  • refactor split-chunks cache-group matching to prune impossible candidates earlier using module-type bucketing and minChunks upper-bound checks
  • make ModuleTypeFilter and ModuleLayerFilter use sync fast paths where possible, and lazily compute module layer / name_for_condition only when needed
  • add focused regressions for module-type/layer helpers plus split-chunks short-circuit cases covering type, layer, and minChunks

Why

  • reduce the cost of matching each module against split-chunks cache groups without changing matching results
  • avoid unnecessary callback work when a cache group cannot possibly match

Validation

  • PATH=/Users/bytedance/.nvm/versions/node/v22.18.0/bin:$PATH pnpm run build:binding:dev
  • PATH=/Users/bytedance/.nvm/versions/node/v22.18.0/bin:$PATH pnpm run test:unit
  • cargo fmt --all --check
  • cargo lint
  • PATH=/Users/bytedance/.nvm/versions/node/v22.18.0/bin:$PATH pnpm run test:base -- -t "configCases/split-chunks/type-layer-short-circuit|configCases/split-chunks/min-chunks-short-circuit"

@github-actions github-actions Bot added the team The issue/pr is created by the member of Rspack. label Apr 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

📝 Benchmark detail: Open

Name Base (9985337) Current Change
10000_big_production-mode_disable-minimize + exec 14.1 s ± 194 ms 14.1 s ± 98 ms -0.18 %
10000_development-mode + exec 956 ms ± 26 ms 949 ms ± 17 ms -0.77 %
10000_development-mode_hmr + stats 178 ms ± 5.9 ms 175 ms ± 3.5 ms -1.61 %
10000_development-mode_noop-loader + exec 2.04 s ± 174 ms 1.99 s ± 205 ms -2.09 %
10000_production-mode + exec 1.09 s ± 28 ms 1.08 s ± 42 ms -0.75 %
10000_production-mode_persistent-cold + exec 1.25 s ± 27 ms 1.25 s ± 53 ms -0.37 %
10000_production-mode_persistent-hot + exec 932 ms ± 29 ms 927 ms ± 38 ms -0.56 %
10000_production-mode_source-map + exec 1.26 s ± 29 ms 1.25 s ± 75 ms -0.45 %
arco-pro_development-mode + exec 1.31 s ± 90 ms 1.35 s ± 45 ms +2.78 %
arco-pro_development-mode_hmr + stats 37 ms ± 0.49 ms 37 ms ± 1.5 ms +0.20 %
arco-pro_production-mode + exec 2.5 s ± 103 ms 2.45 s ± 43 ms -1.75 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 2.57 s ± 113 ms 2.51 s ± 61 ms -2.14 %
arco-pro_production-mode_persistent-cold + exec 2.53 s ± 69 ms 2.54 s ± 75 ms +0.74 %
arco-pro_production-mode_persistent-hot + exec 1.42 s ± 69 ms 1.45 s ± 66 ms +1.56 %
arco-pro_production-mode_source-map + exec 2.92 s ± 92 ms 2.96 s ± 141 ms +1.65 %
arco-pro_production-mode_traverse-chunk-modules + exec 2.54 s ± 73 ms 2.52 s ± 59 ms -0.50 %
bundled-threejs_development-mode + exec 182 ms ± 4.8 ms 181 ms ± 2.9 ms -0.55 %
bundled-threejs_production-mode + exec 216 ms ± 12 ms 212 ms ± 5.4 ms -1.67 %
large-dyn-imports_development-mode + exec 1.21 s ± 38 ms 1.2 s ± 69 ms -0.64 %
large-dyn-imports_production-mode + exec 1.32 s ± 40 ms 1.31 s ± 28 ms -0.59 %
threejs_development-mode_10x + exec 831 ms ± 15 ms 840 ms ± 27 ms +1.03 %
threejs_development-mode_10x_hmr + stats 123 ms ± 6.6 ms 122 ms ± 6.4 ms -0.55 %
threejs_production-mode_10x + exec 3.06 s ± 33 ms 3.04 s ± 45 ms -0.53 %
threejs_production-mode_10x_persistent-cold + exec 3.22 s ± 80 ms 3.16 s ± 50 ms -2.06 %
threejs_production-mode_10x_persistent-hot + exec 2.59 s ± 26 ms 2.56 s ± 19 ms -1.03 %
threejs_production-mode_10x_source-map + exec 3.85 s ± 49 ms 3.84 s ± 75 ms -0.22 %
10000_big_production-mode_disable-minimize + rss memory 1951 MiB ± 74.4 MiB 1960 MiB ± 71.1 MiB +0.45 %
10000_development-mode + rss memory 566 MiB ± 2.45 MiB 568 MiB ± 8.58 MiB +0.46 %
10000_development-mode_hmr + rss memory 786 MiB ± 20.9 MiB 802 MiB ± 30.8 MiB +2.12 %
10000_development-mode_noop-loader + rss memory 870 MiB ± 4.84 MiB 861 MiB ± 2.71 MiB -1.05 %
10000_production-mode + rss memory 508 MiB ± 11.8 MiB 507 MiB ± 13.7 MiB -0.14 %
10000_production-mode_persistent-cold + rss memory 688 MiB ± 12 MiB 686 MiB ± 4.26 MiB -0.21 %
10000_production-mode_persistent-hot + rss memory 670 MiB ± 11.2 MiB 660 MiB ± 5.29 MiB -1.49 %
10000_production-mode_source-map + rss memory 532 MiB ± 8.63 MiB 532 MiB ± 13.6 MiB -0.16 %
arco-pro_development-mode + rss memory 475 MiB ± 10.4 MiB 474 MiB ± 7.07 MiB -0.14 %
arco-pro_development-mode_hmr + rss memory 492 MiB ± 9.99 MiB 489 MiB ± 5.45 MiB -0.57 %
arco-pro_production-mode + rss memory 641 MiB ± 59.2 MiB 656 MiB ± 15.9 MiB +2.39 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 663 MiB ± 13.2 MiB 670 MiB ± 13.1 MiB +1.05 %
arco-pro_production-mode_persistent-cold + rss memory 722 MiB ± 10 MiB 723 MiB ± 3.08 MiB +0.09 %
arco-pro_production-mode_persistent-hot + rss memory 534 MiB ± 11.3 MiB 538 MiB ± 22.3 MiB +0.82 %
arco-pro_production-mode_source-map + rss memory 748 MiB ± 29.9 MiB 747 MiB ± 15.9 MiB -0.13 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 645 MiB ± 62.7 MiB 654 MiB ± 17.1 MiB +1.42 %
bundled-threejs_development-mode + rss memory 159 MiB ± 8.01 MiB 159 MiB ± 8.98 MiB +0.01 %
bundled-threejs_production-mode + rss memory 180 MiB ± 9.23 MiB 184 MiB ± 4.89 MiB +2.60 %
large-dyn-imports_development-mode + rss memory 564 MiB ± 8.89 MiB 563 MiB ± 22.2 MiB -0.12 %
large-dyn-imports_production-mode + rss memory 442 MiB ± 9.74 MiB 446 MiB ± 11.9 MiB +0.73 %
threejs_development-mode_10x + rss memory 522 MiB ± 12.8 MiB 531 MiB ± 17.4 MiB +1.70 %
threejs_development-mode_10x_hmr + rss memory 665 MiB ± 22 MiB 669 MiB ± 21.8 MiB +0.67 %
threejs_production-mode_10x + rss memory 688 MiB ± 13.7 MiB 691 MiB ± 20.2 MiB +0.34 %
threejs_production-mode_10x_persistent-cold + rss memory 805 MiB ± 16 MiB 804 MiB ± 17.7 MiB -0.10 %
threejs_production-mode_10x_persistent-hot + rss memory 576 MiB ± 8.61 MiB 580 MiB ± 9.8 MiB +0.78 %
threejs_production-mode_10x_source-map + rss memory 787 MiB ± 34.9 MiB 803 MiB ± 14.1 MiB +2.03 %

@LingyuCoder LingyuCoder changed the title [codex] refactor split-chunks cache group matching perf: split-chunks cache group matching Apr 8, 2026
@github-actions github-actions Bot added the release: performance release: performance related release(mr only) label Apr 8, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 8, 2026

Merging this PR will degrade performance by 2.23%

⚡ 2 improved benchmarks
❌ 1 regressed benchmark
✅ 15 untouched benchmarks
⏩ 19 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation rust@split_chunks 6.7 ms 6.5 ms +3.55%
Simulation rust@persistent_cache_restore_after_single_file_change@basic-react-development 28.3 ms 27.9 ms +1.63%
Simulation rust@create_chunk_ids 10.6 ms 10.9 ms -2.23%

Comparing codex/split-chunks-cache-group-pruning (688d4d9) with main (9985337)

Open in CodSpeed

Footnotes

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

Rsdoctor Bundle Diff Analysis

Found 6 projects in monorepo, 0 projects with changes.

📊 Quick Summary
Project Total Size Change
popular-libs 1.7 MB 0
react-10k 5.7 MB 0
react-1k 826.9 KB 0
rome 984.1 KB 0
react-5k 2.7 MB 0
ui-components 5.0 MB 0

Generated by Rsdoctor GitHub Action

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

📦 Binary Size-limit

Comparing 688d4d9 to refactor(concatenated-module): reduce clone overhead (#13642) by harpsealjs

❌ Size increased by 3.91KB from 49.35MB to 49.35MB (⬆️0.01%)

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

Labels

release: performance release: performance related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant