Skip to content

perf: reuse module concatenation search state#14833

Open
LingyuCoder wants to merge 1 commit into
seal/module-concat-runtime-cachefrom
seal/module-concat-search-state
Open

perf: reuse module concatenation search state#14833
LingyuCoder wants to merge 1 commit into
seal/module-concat-runtime-cachefrom
seal/module-concat-search-state

Conversation

@LingyuCoder

@LingyuCoder LingyuCoder commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Reuse per-root search scratch storage instead of repeatedly allocating queues and identifier sets.
  • Share immutable bailout data and materialize warning text only when it is reported.
  • Separate search context from mutable state and streamline incoming-module handling in the hot path.

Related links

Checklist

  • Tests updated in the preceding stack layer.
  • Documentation not required.

@LingyuCoder LingyuCoder changed the title perf(module-concat): reuse root search state and bailout data perf: reuse module concatenation search state Jul 17, 2026
@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

📝 Benchmark detail: Open

Name Base (25274d8) Current Change
10000_big_production-mode_disable-minimize + exec 12.1 s ± 334 ms 12.1 s ± 375 ms -0.23 %
10000_development-mode + exec 895 ms ± 19 ms 892 ms ± 19 ms -0.34 %
10000_development-mode_hmr + stats 162 ms ± 18 ms 156 ms ± 12 ms -3.74 %
10000_development-mode_noop-loader + exec 1.78 s ± 135 ms 1.75 s ± 17 ms -1.72 %
10000_production-mode + exec 1.02 s ± 32 ms 1.01 s ± 30 ms -1.23 %
10000_production-mode_persistent-cold + exec 1.21 s ± 38 ms 1.18 s ± 40 ms -2.29 %
10000_production-mode_persistent-hot + exec 634 ms ± 12 ms 633 ms ± 11 ms -0.19 %
10000_production-mode_source-map + exec 1.21 s ± 97 ms 1.17 s ± 27 ms -3.27 %
arco-pro_development-mode + exec 1.25 s ± 40 ms 1.27 s ± 60 ms +1.48 %
arco-pro_development-mode_hmr + stats 33 ms ± 1.3 ms 33 ms ± 0.31 ms -1.59 %
arco-pro_production-mode + exec 2.34 s ± 154 ms 2.32 s ± 114 ms -0.98 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 2.42 s ± 84 ms 2.41 s ± 76 ms -0.26 %
arco-pro_production-mode_persistent-cold + exec 2.4 s ± 129 ms 2.4 s ± 129 ms -0.10 %
arco-pro_production-mode_persistent-hot + exec 344 ms ± 9 ms 342 ms ± 9.7 ms -0.52 %
arco-pro_production-mode_source-map + exec 2.84 s ± 68 ms 2.75 s ± 87 ms -3.12 %
arco-pro_production-mode_source-map_persistent-cold + exec 2.95 s ± 129 ms 2.86 s ± 98 ms -2.97 %
arco-pro_production-mode_source-map_persistent-hot + exec 477 ms ± 7.1 ms 477 ms ± 11 ms 0.00 %
arco-pro_production-mode_traverse-chunk-modules + exec 2.37 s ± 143 ms 2.31 s ± 19 ms -2.61 %
bundled-threejs_development-mode + exec 181 ms ± 2.9 ms 178 ms ± 4 ms -1.66 %
bundled-threejs_production-mode + exec 208 ms ± 5.7 ms 213 ms ± 4.9 ms +2.11 %
large-dyn-imports_development-mode + exec 1.17 s ± 31 ms 1.17 s ± 16 ms -0.10 %
large-dyn-imports_production-mode + exec 1.27 s ± 30 ms 1.25 s ± 39 ms -1.20 %
threejs_development-mode_10x + exec 775 ms ± 13 ms 779 ms ± 11 ms +0.59 %
threejs_development-mode_10x_hmr + stats 112 ms ± 2.7 ms 112 ms ± 17 ms -0.31 %
threejs_production-mode_10x + exec 2.86 s ± 136 ms 2.8 s ± 22 ms -2.07 %
threejs_production-mode_10x_persistent-cold + exec 2.95 s ± 26 ms 2.96 s ± 164 ms +0.42 %
threejs_production-mode_10x_persistent-hot + exec 380 ms ± 7.9 ms 381 ms ± 11 ms +0.26 %
threejs_production-mode_10x_source-map + exec 3.66 s ± 179 ms 3.6 s ± 39 ms -1.84 %
10000_big_production-mode_disable-minimize + rss memory 2179 MiB ± 83.1 MiB 2202 MiB ± 15.2 MiB +1.08 %
10000_development-mode + rss memory 538 MiB ± 14 MiB 542 MiB ± 16.6 MiB +0.87 %
10000_development-mode_hmr + rss memory 788 MiB ± 40.7 MiB 775 MiB ± 18.8 MiB -1.60 %
10000_development-mode_noop-loader + rss memory 805 MiB ± 11.9 MiB 808 MiB ± 6.29 MiB +0.40 %
10000_production-mode + rss memory 466 MiB ± 9.03 MiB 468 MiB ± 9.62 MiB +0.38 %
10000_production-mode_persistent-cold + rss memory 662 MiB ± 11.1 MiB 664 MiB ± 12.3 MiB +0.26 %
10000_production-mode_persistent-hot + rss memory 649 MiB ± 33.8 MiB 665 MiB ± 21.1 MiB +2.61 %
10000_production-mode_source-map + rss memory 483 MiB ± 32.9 MiB 467 MiB ± 27.7 MiB -3.36 %
arco-pro_development-mode + rss memory 399 MiB ± 2.04 MiB 401 MiB ± 9.06 MiB +0.48 %
arco-pro_development-mode_hmr + rss memory 422 MiB ± 8.17 MiB 424 MiB ± 5.41 MiB +0.39 %
arco-pro_production-mode + rss memory 574 MiB ± 12.9 MiB 578 MiB ± 7.43 MiB +0.69 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 588 MiB ± 8.89 MiB 590 MiB ± 12 MiB +0.32 %
arco-pro_production-mode_persistent-cold + rss memory 660 MiB ± 26.3 MiB 667 MiB ± 21.2 MiB +1.20 %
arco-pro_production-mode_persistent-hot + rss memory 293 MiB ± 9.15 MiB 291 MiB ± 6.13 MiB -0.67 %
arco-pro_production-mode_source-map + rss memory 682 MiB ± 11.2 MiB 686 MiB ± 24.3 MiB +0.54 %
arco-pro_production-mode_source-map_persistent-cold + rss memory 812 MiB ± 37.6 MiB 819 MiB ± 21.4 MiB +0.93 %
arco-pro_production-mode_source-map_persistent-hot + rss memory 413 MiB ± 12.3 MiB 419 MiB ± 4.54 MiB +1.62 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 579 MiB ± 11.1 MiB 578 MiB ± 9.59 MiB -0.18 %
bundled-threejs_development-mode + rss memory 126 MiB ± 3.29 MiB 124 MiB ± 6.72 MiB -1.47 %
bundled-threejs_production-mode + rss memory 137 MiB ± 2.18 MiB 138 MiB ± 5.39 MiB +0.37 %
large-dyn-imports_development-mode + rss memory 553 MiB ± 20.4 MiB 554 MiB ± 11.4 MiB +0.26 %
large-dyn-imports_production-mode + rss memory 406 MiB ± 1.63 MiB 405 MiB ± 7.06 MiB -0.14 %
threejs_development-mode_10x + rss memory 432 MiB ± 9.74 MiB 432 MiB ± 9.32 MiB +0.11 %
threejs_development-mode_10x_hmr + rss memory 592 MiB ± 10.9 MiB 594 MiB ± 4.02 MiB +0.41 %
threejs_production-mode_10x + rss memory 615 MiB ± 22.8 MiB 620 MiB ± 12.9 MiB +0.84 %
threejs_production-mode_10x_persistent-cold + rss memory 576 MiB ± 12 MiB 572 MiB ± 8.18 MiB -0.78 %
threejs_production-mode_10x_persistent-hot + rss memory 378 MiB ± 7.36 MiB 376 MiB ± 14 MiB -0.48 %
threejs_production-mode_10x_source-map + rss memory 738 MiB ± 26.3 MiB 743 MiB ± 21.3 MiB +0.71 %

Base persistent cache hit rate: 👍

Current persistent cache hit rate: 👍

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing 5bd606d to Merge eff6ba1349156f4ca56242c7ae1325743724196e into 3191af6832da9cd8963187383c33051753d59bb7 by harpsealjs

⏳ The base commit triggered a linux binding build, but its binary size data has not been generated yet, so the size comparison is skipped.

Please re-run this workflow once the ecosystem-benchmark data for that commit is published.

Warning

Reference only — not the real baseline. The base commit's data isn't ready yet, so this compares against the nearest earlier commit that has data (5cfe1be) for a rough estimate:

❌ Size increased by 8.00KB from 66.66MB to 66.67MB (⬆️0.01%)

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 0 projects with changes.

📊 Quick Summary
Project Total Size Gzip Size Change Gzip Change
popular-libs 1.7 MB 552.1 KB 0 0
react-10k 5.6 MB 1.3 MB 0 0
react-5k 2.7 MB 663.8 KB 0 0
react-1k 823.1 KB 217.0 KB 0 0
ui-components 4.9 MB 1.4 MB 0 0

Generated by Rsdoctor GitHub Action

@codspeed-hq

codspeed-hq Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will improve performance by 20.31%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 4 improved benchmarks
✅ 42 untouched benchmarks
⏩ 47 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation sources@parse_source_map_from_json 9.9 ms 7.5 ms +32.87%
Simulation rust@create_concatenate_module_shared_roots 22.3 ms 17.8 ms +24.79%
Simulation rust@create_concatenate_module_unsupported_syntax 22.4 ms 18.1 ms +23.53%
Simulation rust@create_concatenate_module 13.8 ms 13.5 ms +2.28%

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 seal/module-concat-search-state (5bd606d) with seal/module-concat-runtime-cache (9924a3e)2

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.

  2. No successful run was found on seal/module-concat-runtime-cache (eff6ba1) during the generation of this report, so e027df6 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Reuse per-root search scratch state, share immutable bailout payloads, and defer warning materialization until needed. Keep runtime-dependent analysis cached while reducing transient allocations in the concatenation search.

Co-authored-by: ScriptedAlchemy <zackary.l.jackson@gmail.com>
@LingyuCoder
LingyuCoder force-pushed the seal/module-concat-runtime-cache branch from 9924a3e to eff6ba1 Compare July 21, 2026 07:44
@LingyuCoder
LingyuCoder force-pushed the seal/module-concat-search-state branch from 6e442e8 to 5bd606d Compare July 21, 2026 07:44
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 21, 2026

Copy link
Copy Markdown

Deploying rspack with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5bd606d
Status: ✅  Deploy successful!
Preview URL: https://7d8a4b2e.rspack-v2.pages.dev
Branch Preview URL: https://seal-module-concat-search-st.rspack-v2.pages.dev

View logs

@LingyuCoder
LingyuCoder marked this pull request as ready for review July 21, 2026 07:50
Copilot AI review requested due to automatic review settings July 21, 2026 07:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@LingyuCoder
LingyuCoder requested a review from JSerFeng July 21, 2026 10:47
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.

3 participants