Skip to content

refactor(core): reuse existing leaf chunk graphs#14840

Draft
LingyuCoder wants to merge 1 commit into
seal/hmr-async-outgoings-14769from
seal/hmr-existing-leaf-14768
Draft

refactor(core): reuse existing leaf chunk graphs#14840
LingyuCoder wants to merge 1 commit into
seal/hmr-async-outgoings-14769from
seal/hmr-existing-leaf-14768

Conversation

@LingyuCoder

@LingyuCoder LingyuCoder commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Extend the incremental chunk graph fast path to terminal modules that already exist in the recovered graph.
  • Preserve conservative fallback behavior when a leaf is new or topology changes.
  • Cover terminal edits, duplicate roots, pre-order indices, and affected-module recovery.

Related links

Source PR: #14772

Closes #14768

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Allow incremental chunk graph reuse when an already-built terminal module has no outgoing connections. Cover terminal edits, duplicate entry roots, and pre-order index watches.

Co-authored-by: Matthew Davis <276116661+matthewdavis-oai@users.noreply.github.com>
@LingyuCoder LingyuCoder changed the title perf(core): reuse existing leaf chunk graphs refactor(core): reuse existing leaf chunk graphs 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 ± 273 ms +0.12 %
10000_development-mode + exec 895 ms ± 19 ms 885 ms ± 24 ms -1.12 %
10000_development-mode_hmr + stats 162 ms ± 18 ms 155 ms ± 8.9 ms -4.40 %
10000_development-mode_noop-loader + exec 1.78 s ± 135 ms 1.73 s ± 24 ms -2.83 %
10000_production-mode + exec 1.02 s ± 32 ms 1.04 s ± 157 ms +1.17 %
10000_production-mode_persistent-cold + exec 1.21 s ± 38 ms 1.17 s ± 42 ms -3.25 %
10000_production-mode_persistent-hot + exec 634 ms ± 12 ms 632 ms ± 25 ms -0.44 %
10000_production-mode_source-map + exec 1.21 s ± 97 ms 1.17 s ± 29 ms -3.17 %
arco-pro_development-mode + exec 1.25 s ± 40 ms 1.29 s ± 98 ms +2.94 %
arco-pro_development-mode_hmr + stats 33 ms ± 1.3 ms 33 ms ± 0.82 ms -0.71 %
arco-pro_production-mode + exec 2.34 s ± 154 ms 2.31 s ± 81 ms -1.03 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 2.42 s ± 84 ms 2.4 s ± 69 ms -0.72 %
arco-pro_production-mode_persistent-cold + exec 2.4 s ± 129 ms 2.35 s ± 67 ms -2.03 %
arco-pro_production-mode_persistent-hot + exec 344 ms ± 9 ms 344 ms ± 6.7 ms +0.12 %
arco-pro_production-mode_source-map + exec 2.84 s ± 68 ms 2.74 s ± 38 ms -3.74 %
arco-pro_production-mode_source-map_persistent-cold + exec 2.95 s ± 129 ms 2.86 s ± 99 ms -2.82 %
arco-pro_production-mode_source-map_persistent-hot + exec 477 ms ± 7.1 ms 476 ms ± 8.1 ms -0.34 %
arco-pro_production-mode_traverse-chunk-modules + exec 2.37 s ± 143 ms 2.37 s ± 91 ms -0.18 %
bundled-threejs_development-mode + exec 181 ms ± 2.9 ms 178 ms ± 6.8 ms -1.55 %
bundled-threejs_production-mode + exec 208 ms ± 5.7 ms 211 ms ± 8.7 ms +1.34 %
large-dyn-imports_development-mode + exec 1.17 s ± 31 ms 1.18 s ± 51 ms +1.20 %
large-dyn-imports_production-mode + exec 1.27 s ± 30 ms 1.26 s ± 25 ms -0.60 %
threejs_development-mode_10x + exec 775 ms ± 13 ms 777 ms ± 6.4 ms +0.26 %
threejs_development-mode_10x_hmr + stats 112 ms ± 2.7 ms 112 ms ± 14 ms -0.68 %
threejs_production-mode_10x + exec 2.86 s ± 136 ms 2.79 s ± 33 ms -2.27 %
threejs_production-mode_10x_persistent-cold + exec 2.95 s ± 26 ms 2.92 s ± 29 ms -1.22 %
threejs_production-mode_10x_persistent-hot + exec 380 ms ± 7.9 ms 377 ms ± 9.3 ms -0.68 %
threejs_production-mode_10x_source-map + exec 3.66 s ± 179 ms 3.58 s ± 33 ms -2.24 %
10000_big_production-mode_disable-minimize + rss memory 2179 MiB ± 83.1 MiB 2193 MiB ± 40.7 MiB +0.68 %
10000_development-mode + rss memory 538 MiB ± 14 MiB 543 MiB ± 4.11 MiB +0.96 %
10000_development-mode_hmr + rss memory 788 MiB ± 40.7 MiB 776 MiB ± 30.8 MiB -1.41 %
10000_development-mode_noop-loader + rss memory 805 MiB ± 11.9 MiB 808 MiB ± 12 MiB +0.38 %
10000_production-mode + rss memory 466 MiB ± 9.03 MiB 461 MiB ± 27.6 MiB -1.09 %
10000_production-mode_persistent-cold + rss memory 662 MiB ± 11.1 MiB 666 MiB ± 15.4 MiB +0.59 %
10000_production-mode_persistent-hot + rss memory 649 MiB ± 33.8 MiB 664 MiB ± 34.5 MiB +2.39 %
10000_production-mode_source-map + rss memory 483 MiB ± 32.9 MiB 474 MiB ± 8.06 MiB -1.96 %
arco-pro_development-mode + rss memory 399 MiB ± 2.04 MiB 403 MiB ± 5.49 MiB +1.01 %
arco-pro_development-mode_hmr + rss memory 422 MiB ± 8.17 MiB 423 MiB ± 2.68 MiB +0.23 %
arco-pro_production-mode + rss memory 574 MiB ± 12.9 MiB 577 MiB ± 10.1 MiB +0.49 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 588 MiB ± 8.89 MiB 592 MiB ± 6.28 MiB +0.67 %
arco-pro_production-mode_persistent-cold + rss memory 660 MiB ± 26.3 MiB 659 MiB ± 8.98 MiB -0.04 %
arco-pro_production-mode_persistent-hot + rss memory 293 MiB ± 9.15 MiB 294 MiB ± 11.1 MiB +0.37 %
arco-pro_production-mode_source-map + rss memory 682 MiB ± 11.2 MiB 686 MiB ± 19.3 MiB +0.52 %
arco-pro_production-mode_source-map_persistent-cold + rss memory 812 MiB ± 37.6 MiB 810 MiB ± 31.1 MiB -0.14 %
arco-pro_production-mode_source-map_persistent-hot + rss memory 413 MiB ± 12.3 MiB 421 MiB ± 15.1 MiB +2.09 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 579 MiB ± 11.1 MiB 581 MiB ± 19.8 MiB +0.34 %
bundled-threejs_development-mode + rss memory 126 MiB ± 3.29 MiB 126 MiB ± 8.51 MiB -0.13 %
bundled-threejs_production-mode + rss memory 137 MiB ± 2.18 MiB 139 MiB ± 4.56 MiB +1.64 %
large-dyn-imports_development-mode + rss memory 553 MiB ± 20.4 MiB 551 MiB ± 12.9 MiB -0.40 %
large-dyn-imports_production-mode + rss memory 406 MiB ± 1.63 MiB 406 MiB ± 7.16 MiB +0.13 %
threejs_development-mode_10x + rss memory 432 MiB ± 9.74 MiB 439 MiB ± 19.2 MiB +1.56 %
threejs_development-mode_10x_hmr + rss memory 592 MiB ± 10.9 MiB 605 MiB ± 32 MiB +2.17 %
threejs_production-mode_10x + rss memory 615 MiB ± 22.8 MiB 621 MiB ± 20.8 MiB +0.94 %
threejs_production-mode_10x_persistent-cold + rss memory 576 MiB ± 12 MiB 571 MiB ± 10.8 MiB -0.96 %
threejs_production-mode_10x_persistent-hot + rss memory 378 MiB ± 7.36 MiB 371 MiB ± 10.9 MiB -1.89 %
threejs_production-mode_10x_source-map + rss memory 738 MiB ± 26.3 MiB 732 MiB ± 38 MiB -0.82 %

Base persistent cache hit rate: 👍

Current persistent cache hit rate: 👍

@github-actions

Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing c360985 to perf(core): reuse stable async chunk graphs 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 (25274d8) for a rough estimate:

❌ Size increased by 36.00KB from 66.59MB to 66.63MB (⬆️0.05%)

@github-actions

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 5 projects with changes.

📊 Quick Summary
Project Total Size Gzip Size Change Gzip Change
popular-libs 1.7 MB 552.1 KB - -
react-10k 5.6 MB 1.3 MB - -
react-1k 823.1 KB 217.0 KB - -
react-5k 2.7 MB 663.8 KB - -
ui-components 4.9 MB 1.4 MB - -
📋 Detailed Reports (Click to expand)

📁 popular-libs

Path: ../build-tools-performance/cases/popular-libs/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 1.7 MB - -
🗜️ Gzip Size 552.1 KB - -
📄 JavaScript 1.7 MB - -
🎨 CSS 0 B - -
🌐 HTML 289.0 B - -
📁 Other Assets 0 B - -

📁 react-10k

Path: ../build-tools-performance/cases/react-10k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 5.6 MB - -
🗜️ Gzip Size 1.3 MB - -
📄 JavaScript 5.6 MB - -
🎨 CSS 21.0 B - -
🌐 HTML 328.0 B - -
📁 Other Assets 0 B - -

📁 react-1k

Path: ../build-tools-performance/cases/react-1k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 823.1 KB - -
🗜️ Gzip Size 217.0 KB - -
📄 JavaScript 822.7 KB - -
🎨 CSS 0 B - -
🌐 HTML 328.0 B - -
📁 Other Assets 0 B - -

📁 react-5k

Path: ../build-tools-performance/cases/react-5k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 2.7 MB - -
🗜️ Gzip Size 663.8 KB - -
📄 JavaScript 2.7 MB - -
🎨 CSS 21.0 B - -
🌐 HTML 328.0 B - -
📁 Other Assets 0 B - -

📁 ui-components

Path: ../build-tools-performance/cases/ui-components/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 4.9 MB - -
🗜️ Gzip Size 1.4 MB - -
📄 JavaScript 4.8 MB - -
🎨 CSS 112.1 KB - -
🌐 HTML 328.0 B - -
📁 Other Assets 0 B - -

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 2.98%

⚠️ 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

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

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation rust@create_chunk_assets 1.5 ms 1.4 ms +2.98%

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/hmr-existing-leaf-14768 (c360985) with seal/hmr-async-outgoings-14769 (df09b48)

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.

[Perf]: editing an existing leaf falsely rebuilds the chunk graph

1 participant