Skip to content

perf(real-content-hash): skip redundant work in hash pass#13647

Draft
LingyuCoder wants to merge 1 commit intomainfrom
codex/real-content-hash-fast-paths
Draft

perf(real-content-hash): skip redundant work in hash pass#13647
LingyuCoder wants to merge 1 commit intomainfrom
codex/real-content-hash-fast-paths

Conversation

@LingyuCoder
Copy link
Copy Markdown
Contributor

Summary

  • avoid storing owned string content for assets that do not reference any tracked content hash
  • skip building intermediate batch_sources/asset_contents when no update_hash hook is registered
  • avoid no-op asset updates in the final rewrite pass and add focused unit tests for the new fast paths

Related links

  • ecosystem benchmark will be triggered after PR creation

Why

RealContentHashPlugin was doing extra allocation and bookkeeping work even when assets had no relevant hash matches, when no hook consumed the rebuilt sources, or when the final asset update was effectively a no-op. This change keeps the existing behavior but removes those redundant paths.

Validation

  • cargo test -p rspack_plugin_real_content_hash
  • cargo clippy -p rspack_plugin_real_content_hash --all-targets -- -D warnings
  • cargo fmt --all --check
  • pnpm run build:binding:dev
  • pnpm -C tests/rspack-test exec rstest run --include Hash.test.js -t "hashCases-hashCases/real-content-hash" --project base --bail 1
  • pnpm -C tests/rspack-test exec rstest run --include Config.part3.test.js -t "configCases-configCases/sri/runtime-requirement" --project base --bail 1

Checklist

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

@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 (84288f4) Current Change
10000_big_production-mode_disable-minimize + exec 14 s ± 183 ms 14 s ± 253 ms +0.29 %
10000_development-mode + exec 950 ms ± 35 ms 943 ms ± 22 ms -0.74 %
10000_development-mode_hmr + stats 175 ms ± 5.4 ms 173 ms ± 3.9 ms -1.28 %
10000_development-mode_noop-loader + exec 1.97 s ± 85 ms 1.94 s ± 65 ms -1.58 %
10000_production-mode + exec 1.06 s ± 29 ms 1.06 s ± 26 ms -0.34 %
10000_production-mode_persistent-cold + exec 1.24 s ± 30 ms 1.23 s ± 12 ms -0.98 %
10000_production-mode_persistent-hot + exec 912 ms ± 21 ms 915 ms ± 10 ms +0.31 %
10000_production-mode_source-map + exec 1.25 s ± 34 ms 1.24 s ± 51 ms -0.91 %
arco-pro_development-mode + exec 1.34 s ± 59 ms 1.32 s ± 79 ms -1.61 %
arco-pro_development-mode_hmr + stats 37 ms ± 1.1 ms 37 ms ± 2.6 ms +1.09 %
arco-pro_production-mode + exec 2.47 s ± 62 ms 2.46 s ± 112 ms -0.46 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 2.57 s ± 163 ms 2.51 s ± 98 ms -2.48 %
arco-pro_production-mode_persistent-cold + exec 2.48 s ± 30 ms 2.49 s ± 65 ms +0.43 %
arco-pro_production-mode_persistent-hot + exec 1.42 s ± 53 ms 1.38 s ± 56 ms -2.53 %
arco-pro_production-mode_source-map + exec 2.91 s ± 56 ms 2.93 s ± 110 ms +0.56 %
arco-pro_production-mode_traverse-chunk-modules + exec 2.48 s ± 49 ms 2.51 s ± 206 ms +1.07 %
bundled-threejs_development-mode + exec 182 ms ± 2.9 ms 181 ms ± 4.6 ms -0.66 %
bundled-threejs_production-mode + exec 213 ms ± 5.1 ms 210 ms ± 5.2 ms -1.59 %
large-dyn-imports_development-mode + exec 1.2 s ± 39 ms 1.19 s ± 20 ms -0.95 %
large-dyn-imports_production-mode + exec 1.32 s ± 61 ms 1.29 s ± 47 ms -1.72 %
threejs_development-mode_10x + exec 849 ms ± 51 ms 832 ms ± 30 ms -2.07 %
threejs_development-mode_10x_hmr + stats 119 ms ± 0.81 ms 117 ms ± 3.8 ms -1.42 %
threejs_production-mode_10x + exec 3.02 s ± 23 ms 3.01 s ± 17 ms -0.52 %
threejs_production-mode_10x_persistent-cold + exec 3.18 s ± 128 ms 3.14 s ± 23 ms -1.16 %
threejs_production-mode_10x_persistent-hot + exec 2.55 s ± 25 ms 2.54 s ± 92 ms -0.37 %
threejs_production-mode_10x_source-map + exec 3.81 s ± 63 ms 3.77 s ± 35 ms -0.96 %
10000_big_production-mode_disable-minimize + rss memory 1969 MiB ± 66.7 MiB 1936 MiB ± 52.5 MiB -1.67 %
10000_development-mode + rss memory 570 MiB ± 6.98 MiB 572 MiB ± 12.4 MiB +0.36 %
10000_development-mode_hmr + rss memory 812 MiB ± 45.3 MiB 802 MiB ± 17.2 MiB -1.22 %
10000_development-mode_noop-loader + rss memory 864 MiB ± 14.2 MiB 866 MiB ± 9.88 MiB +0.25 %
10000_production-mode + rss memory 510 MiB ± 12.5 MiB 506 MiB ± 11.2 MiB -0.78 %
10000_production-mode_persistent-cold + rss memory 688 MiB ± 7.3 MiB 687 MiB ± 10.7 MiB -0.11 %
10000_production-mode_persistent-hot + rss memory 667 MiB ± 24.8 MiB 667 MiB ± 15.3 MiB +0.13 %
10000_production-mode_source-map + rss memory 534 MiB ± 11.1 MiB 533 MiB ± 8.64 MiB -0.21 %
arco-pro_development-mode + rss memory 477 MiB ± 8.44 MiB 476 MiB ± 8.02 MiB -0.11 %
arco-pro_development-mode_hmr + rss memory 491 MiB ± 10.9 MiB 489 MiB ± 4.87 MiB -0.47 %
arco-pro_production-mode + rss memory 652 MiB ± 14 MiB 658 MiB ± 12.8 MiB +0.91 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 669 MiB ± 8.19 MiB 680 MiB ± 14.4 MiB +1.66 %
arco-pro_production-mode_persistent-cold + rss memory 726 MiB ± 8.08 MiB 731 MiB ± 11.8 MiB +0.67 %
arco-pro_production-mode_persistent-hot + rss memory 526 MiB ± 12.5 MiB 526 MiB ± 16.9 MiB +0.05 %
arco-pro_production-mode_source-map + rss memory 738 MiB ± 8.73 MiB 741 MiB ± 9.29 MiB +0.32 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 652 MiB ± 11.7 MiB 663 MiB ± 15.9 MiB +1.62 %
bundled-threejs_development-mode + rss memory 159 MiB ± 8.96 MiB 161 MiB ± 2.03 MiB +0.95 %
bundled-threejs_production-mode + rss memory 179 MiB ± 9.36 MiB 182 MiB ± 8.69 MiB +1.37 %
large-dyn-imports_development-mode + rss memory 566 MiB ± 10.6 MiB 577 MiB ± 19.5 MiB +1.89 %
large-dyn-imports_production-mode + rss memory 442 MiB ± 6.56 MiB 449 MiB ± 8.95 MiB +1.59 %
threejs_development-mode_10x + rss memory 523 MiB ± 17.1 MiB 535 MiB ± 16.9 MiB +2.27 %
threejs_development-mode_10x_hmr + rss memory 673 MiB ± 14.6 MiB 670 MiB ± 10.5 MiB -0.50 %
threejs_production-mode_10x + rss memory 692 MiB ± 25.4 MiB 700 MiB ± 17.8 MiB +1.19 %
threejs_production-mode_10x_persistent-cold + rss memory 806 MiB ± 10.9 MiB 817 MiB ± 15.9 MiB +1.28 %
threejs_production-mode_10x_persistent-hot + rss memory 577 MiB ± 5.43 MiB 586 MiB ± 9.01 MiB +1.56 %
threejs_production-mode_10x_source-map + rss memory 799 MiB ± 29.8 MiB 804 MiB ± 28.2 MiB +0.67 %

@github-actions github-actions Bot added the release: bug fix release: bug related release(mr only) label Apr 8, 2026
@LingyuCoder LingyuCoder changed the title fix(real-content-hash): skip redundant work in hash pass perf(real-content-hash): skip redundant work in hash pass Apr 8, 2026
@github-actions github-actions Bot added release: performance release: performance related release(mr only) and removed release: bug fix release: bug related release(mr only) labels Apr 8, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 8, 2026

Merging this PR will degrade performance by 36.71%

🎉 Hooray! codspeed-node just leveled up to 5.2.0!

A heads-up, this is a breaking change and it might affect your current performance baseline a bit. But here's the exciting part - it's packed with new, cool features and promises improved result stability 🥳!
Curious about what's new? Visit our releases page to delve into all the awesome details about this new version.

❌ 1 regressed benchmark
✅ 8 untouched benchmarks
⏩ 28 skipped benchmarks1

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

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation js@Traverse module graph by dependencies 530.2 µs 837.7 µs -36.71%

Comparing codex/real-content-hash-fast-paths (05fb33a) with main (84288f4)

Open in CodSpeed

Footnotes

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

⚠️ Note: The latest commit (84288f48aa) does not have baseline artifacts. Using commit 9985337b82 for baseline comparison instead. If this seems incorrect, please wait a few minutes and try rerunning the workflow.

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
react-5k 2.7 MB 0
rome 984.1 KB 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 05fb33a to feat(create-rspack): modernize starter template configs (#13645) by neverland

❌ Size increased by 416bytes from 49.35MB to 49.35MB (⬆️0.00%)

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