Skip to content

perf(core): use dense storage for dependency connections#14148

Merged
hardfist merged 4 commits into
mainfrom
cursor/dense-dependency-connections-8c76
May 26, 2026
Merged

perf(core): use dense storage for dependency connections#14148
hardfist merged 4 commits into
mainfrom
cursor/dense-dependency-connections-8c76

Conversation

@hardfist

@hardfist hardfist commented May 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Use dense DependencyId-indexed overlay storage for module graph connections to avoid hash lookups on the hot connection_by_dependency_id path while preserving checkpoint/reset behavior.

Note: the paged dense storage follow-up was reverted in 33cc9dfa7c per request.

Related links

N/A

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
Open in Web Open in Cursor 

cursoragent and others added 2 commits May 25, 2026 11:05
Co-authored-by: hardfist <1562502418@qq.com>
Co-authored-by: hardfist <1562502418@qq.com>
@cursor

cursor Bot commented May 26, 2026

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@github-actions

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing 33cc9df to chore: upgrade swc_core from 66 to 67 (#14135) by hardfist

❌ Size increased by 4.00KB from 61.76MB to 61.76MB (⬆️0.01%)

@github-actions

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 1 project with changes.

📊 Quick Summary
Project Total Size Change
popular-libs 1.7 MB -48.0 B (-0.0%)
react-10k 5.7 MB 0
react-1k 827.2 KB 0
react-5k 2.7 MB 0
ui-components 4.8 MB 0
📋 Detailed Reports (Click to expand)

📁 popular-libs

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

📌 Baseline Commit: c6fb557e2d | PR: #14135

Metric Current Baseline Change
📊 Total Size 1.7 MB 1.7 MB -48.0 B (-0.0%)
📄 JavaScript 1.7 MB 1.7 MB -48.0 B (-0.0%)
🎨 CSS 0 B 0 B 0
🌐 HTML 289.0 B 289.0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: popular-libs Bundle Diff

Generated by Rsdoctor GitHub Action

@codspeed-hq

codspeed-hq Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will improve performance by 10.34%

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

⚡ 6 improved benchmarks
✅ 31 untouched benchmarks
⏩ 25 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation rust@build_chunk_graph 72.3 ms 69.8 ms +3.63%
Simulation rust@create_named_chunk_ids 6.6 ms 6.2 ms +7.36%
Simulation rust@module_graph_api 11.7 ms 8.1 ms +43.61%
Simulation rust@flag_dependency_exports 11.4 ms 10.9 ms +4.28%
Simulation rust@create_chunk_ids 6.7 ms 6.3 ms +6.06%
Simulation rust@create_concatenate_module 34.1 ms 33.4 ms +2.14%

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 cursor/dense-dependency-connections-8c76 (33cc9df) with main (c6fb557)

Open in CodSpeed

Footnotes

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

github-actions Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

📝 Benchmark detail: Open

No benchmark data for commit 0ccfa7b, trying parent...

Name Base (b0bdcf8) Current Change
10000_big_production-mode_disable-minimize + exec 13.3 s ± 232 ms 13.3 s ± 282 ms -0.29 %
10000_development-mode + exec 876 ms ± 42 ms 870 ms ± 27 ms -0.66 %
10000_development-mode_hmr + stats 160 ms ± 14 ms 152 ms ± 3.9 ms -4.65 %
10000_development-mode_noop-loader + exec 1.92 s ± 92 ms 1.9 s ± 27 ms -0.70 %
10000_production-mode + exec 991 ms ± 66 ms 971 ms ± 29 ms -2.10 %
10000_production-mode_persistent-cold + exec 1.17 s ± 20 ms 1.14 s ± 46 ms -2.44 %
10000_production-mode_persistent-hot + exec 604 ms ± 17 ms 593 ms ± 23 ms -1.79 %
10000_production-mode_source-map + exec 1.16 s ± 40 ms 1.13 s ± 21 ms -2.19 %
arco-pro_development-mode + exec 1.31 s ± 76 ms 1.32 s ± 98 ms +0.64 %
arco-pro_development-mode_hmr + stats 33 ms ± 0.39 ms 33 ms ± 0.5 ms -1.81 %
arco-pro_production-mode + exec 2.32 s ± 128 ms 2.31 s ± 136 ms -0.23 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 2.44 s ± 75 ms 2.42 s ± 154 ms -0.85 %
arco-pro_production-mode_persistent-cold + exec 2.34 s ± 96 ms 2.37 s ± 111 ms +1.44 %
arco-pro_production-mode_persistent-hot + exec 345 ms ± 9.7 ms 342 ms ± 10 ms -0.87 %
arco-pro_production-mode_source-map + exec 2.78 s ± 59 ms 2.76 s ± 45 ms -0.60 %
arco-pro_production-mode_traverse-chunk-modules + exec 2.37 s ± 130 ms 2.37 s ± 130 ms +0.11 %
bundled-threejs_development-mode + exec 180 ms ± 1.2 ms 180 ms ± 2.9 ms +0.11 %
bundled-threejs_production-mode + exec 209 ms ± 6.2 ms 210 ms ± 10 ms +0.57 %
large-dyn-imports_development-mode + exec 1.1 s ± 22 ms 1.1 s ± 33 ms -0.18 %
large-dyn-imports_production-mode + exec 1.25 s ± 13 ms 1.25 s ± 26 ms +0.35 %
threejs_development-mode_10x + exec 822 ms ± 26 ms 822 ms ± 39 ms +0.02 %
threejs_development-mode_10x_hmr + stats 110 ms ± 3 ms 109 ms ± 5.5 ms -1.30 %
threejs_production-mode_10x + exec 2.8 s ± 29 ms 2.8 s ± 22 ms +0.04 %
threejs_production-mode_10x_persistent-cold + exec 2.95 s ± 25 ms 2.99 s ± 119 ms +1.45 %
threejs_production-mode_10x_persistent-hot + exec 388 ms ± 18 ms 387 ms ± 5.6 ms -0.26 %
threejs_production-mode_10x_source-map + exec 3.59 s ± 96 ms 3.57 s ± 41 ms -0.40 %
10000_big_production-mode_disable-minimize + rss memory 1978 MiB ± 55.4 MiB 1979 MiB ± 28.1 MiB +0.04 %
10000_development-mode + rss memory 592 MiB ± 12.5 MiB 585 MiB ± 20 MiB -1.23 %
10000_development-mode_hmr + rss memory 806 MiB ± 33.2 MiB 815 MiB ± 18 MiB +1.21 %
10000_development-mode_noop-loader + rss memory 888 MiB ± 16.2 MiB 881 MiB ± 6.54 MiB -0.70 %
10000_production-mode + rss memory 548 MiB ± 10.8 MiB 537 MiB ± 9.65 MiB -2.03 %
10000_production-mode_persistent-cold + rss memory 719 MiB ± 4.94 MiB 707 MiB ± 17.9 MiB -1.63 %
10000_production-mode_persistent-hot + rss memory 637 MiB ± 10 MiB 621 MiB ± 20.2 MiB -2.36 %
10000_production-mode_source-map + rss memory 534 MiB ± 31.6 MiB 528 MiB ± 75.5 MiB -0.98 %
arco-pro_development-mode + rss memory 483 MiB ± 9.54 MiB 482 MiB ± 4.54 MiB -0.19 %
arco-pro_development-mode_hmr + rss memory 494 MiB ± 7.19 MiB 497 MiB ± 6.76 MiB +0.59 %
arco-pro_production-mode + rss memory 669 MiB ± 20.6 MiB 674 MiB ± 14.9 MiB +0.84 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 683 MiB ± 20 MiB 696 MiB ± 5.48 MiB +1.77 %
arco-pro_production-mode_persistent-cold + rss memory 747 MiB ± 11.2 MiB 742 MiB ± 16 MiB -0.65 %
arco-pro_production-mode_persistent-hot + rss memory 381 MiB ± 26.8 MiB 369 MiB ± 31.1 MiB -3.25 %
arco-pro_production-mode_source-map + rss memory 760 MiB ± 14.2 MiB 761 MiB ± 13.4 MiB +0.15 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 681 MiB ± 10.5 MiB 684 MiB ± 9.69 MiB +0.42 %
bundled-threejs_development-mode + rss memory 152 MiB ± 8.39 MiB 151 MiB ± 5.81 MiB -1.00 %
bundled-threejs_production-mode + rss memory 179 MiB ± 7.05 MiB 178 MiB ± 10.6 MiB -0.52 %
large-dyn-imports_development-mode + rss memory 596 MiB ± 3.94 MiB 594 MiB ± 9.03 MiB -0.44 %
large-dyn-imports_production-mode + rss memory 461 MiB ± 10.4 MiB 460 MiB ± 4.45 MiB -0.15 %
threejs_development-mode_10x + rss memory 542 MiB ± 5.84 MiB 535 MiB ± 7.05 MiB -1.28 %
threejs_development-mode_10x_hmr + rss memory 667 MiB ± 27.1 MiB 667 MiB ± 24.2 MiB -0.03 %
threejs_production-mode_10x + rss memory 719 MiB ± 10.9 MiB 714 MiB ± 9.79 MiB -0.67 %
threejs_production-mode_10x_persistent-cold + rss memory 679 MiB ± 11.3 MiB 683 MiB ± 17 MiB +0.65 %
threejs_production-mode_10x_persistent-hot + rss memory 474 MiB ± 8.3 MiB 474 MiB ± 13.3 MiB +0.01 %
threejs_production-mode_10x_source-map + rss memory 824 MiB ± 25.5 MiB 833 MiB ± 29.6 MiB +1.17 %

Base persistent cache hit rate: 👍

Current persistent cache hit rate: 👍

@hardfist hardfist marked this pull request as ready for review May 26, 2026 03:48
Copilot AI review requested due to automatic review settings May 26, 2026 03:48

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 33cc9dfa7c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

Pull request overview

This PR introduces a dense, DependencyId-indexed overlay storage for ModuleGraph connections to reduce hash lookups on the hot connection_by_dependency_id path while keeping the existing checkpoint/reset rollback semantics.

Changes:

  • Added DenseDependencyIdOverlayMap (Vec-backed base + optional overlay) for DependencyId-indexed storage.
  • Switched ModuleGraphData.connections to use the dense overlay map instead of a hashed OverlayMap.
  • Exported the new dense overlay map via the rollback module.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
crates/rspack_core/src/module_graph/rollback/mod.rs Exposes the new dense overlay map module and re-exports it.
crates/rspack_core/src/module_graph/rollback/dense_dependency_id_overlay_map.rs Implements Vec-backed overlay storage indexed by DependencyId, including unit tests.
crates/rspack_core/src/module_graph/mod.rs Replaces hashed connection storage with the new dense overlay map for faster lookup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/rspack_core/src/module_graph/mod.rs
@hardfist hardfist merged commit 5b17418 into main May 26, 2026
38 checks passed
@hardfist hardfist deleted the cursor/dense-dependency-connections-8c76 branch May 26, 2026 04:00
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.

4 participants