Skip to content

Conversation

@jerrykingxyz
Copy link
Contributor

@jerrykingxyz jerrykingxyz commented Nov 27, 2025

Summary

  • ContextDependencies will traverse all subdirectories and calculate hashes, which will result in higher performance overhead.

Related links

Checklist

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

Copilot AI review requested due to automatic review settings November 27, 2025 06:52
@netlify
Copy link

netlify bot commented Nov 27, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 5dbcedb
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/6927f9de88b56300070ce147

@github-actions github-actions bot added release: bug fix release: bug related release(mr only) team The issue/pr is created by the member of Rspack. labels Nov 27, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 27, 2025

📝 Benchmark detail: Open

Name Base (2025-11-27 5795e26) Current Change
10000_big_production-mode_disable-minimize + exec 24.9 s ± 701 ms 24.9 s ± 716 ms -0.16 %
10000_development-mode + exec 1.29 s ± 30 ms 1.28 s ± 152 ms -0.91 %
10000_development-mode_hmr + exec 606 ms ± 10 ms 601 ms ± 15 ms -0.85 %
10000_development-mode_noop-loader + exec 2.21 s ± 52 ms 2.2 s ± 75 ms -0.44 %
10000_production-mode + exec 1.34 s ± 29 ms 1.31 s ± 25 ms -1.85 %
10000_production-mode_persistent-cold + exec 1.48 s ± 18 ms 1.46 s ± 47 ms -1.37 %
10000_production-mode_persistent-hot + exec 1.03 s ± 15 ms 1.05 s ± 169 ms +2.18 %
arco-pro_development-mode + exec 1.59 s ± 24 ms 1.6 s ± 65 ms +0.89 %
arco-pro_development-mode_hmr + exec 358 ms ± 0.92 ms 358 ms ± 1.2 ms -0.05 %
arco-pro_production-mode + exec 2.91 s ± 80 ms 2.85 s ± 88 ms -1.98 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.02 s ± 250 ms 2.9 s ± 98 ms -3.82 %
arco-pro_production-mode_persistent-cold + exec 2.98 s ± 37 ms 2.94 s ± 85 ms -1.35 %
arco-pro_production-mode_persistent-hot + exec 1.66 s ± 33 ms 1.64 s ± 39 ms -1.01 %
arco-pro_production-mode_traverse-chunk-modules + exec 2.94 s ± 210 ms 2.87 s ± 94 ms -2.43 %
large-dyn-imports_development-mode + exec 1.59 s ± 64 ms 1.55 s ± 21 ms -2.80 %
large-dyn-imports_production-mode + exec 1.6 s ± 48 ms 1.61 s ± 118 ms +0.60 %
threejs_development-mode_10x + exec 1.28 s ± 24 ms 1.28 s ± 34 ms -0.06 %
threejs_development-mode_10x_hmr + exec 894 ms ± 12 ms 898 ms ± 6.6 ms +0.46 %
threejs_production-mode_10x + exec 3.92 s ± 211 ms 3.92 s ± 207 ms +0.08 %
threejs_production-mode_10x_persistent-cold + exec 4.02 s ± 143 ms 4 s ± 35 ms -0.70 %
threejs_production-mode_10x_persistent-hot + exec 3.47 s ± 37 ms 3.51 s ± 147 ms +1.02 %
10000_big_production-mode_disable-minimize + rss memory 5362 MiB ± 63.5 MiB 5343 MiB ± 146 MiB -0.35 %
10000_development-mode + rss memory 585 MiB ± 12.9 MiB 580 MiB ± 17.2 MiB -0.87 %
10000_development-mode_hmr + rss memory 738 MiB ± 35.2 MiB 740 MiB ± 13.9 MiB +0.18 %
10000_development-mode_noop-loader + rss memory 877 MiB ± 29.4 MiB 878 MiB ± 25.7 MiB +0.15 %
10000_production-mode + rss memory 608 MiB ± 19.5 MiB 596 MiB ± 21.2 MiB -1.86 %
10000_production-mode_persistent-cold + rss memory 685 MiB ± 19.3 MiB 684 MiB ± 40 MiB -0.07 %
10000_production-mode_persistent-hot + rss memory 687 MiB ± 37.6 MiB 675 MiB ± 17.7 MiB -1.79 %
arco-pro_development-mode + rss memory 477 MiB ± 60.8 MiB 456 MiB ± 15.6 MiB -4.49 %
arco-pro_development-mode_hmr + rss memory 391 MiB ± 19 MiB 391 MiB ± 12.1 MiB -0.15 %
arco-pro_production-mode + rss memory 568 MiB ± 84.2 MiB 601 MiB ± 72.6 MiB +5.84 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 589 MiB ± 74.9 MiB 615 MiB ± 70.5 MiB +4.44 %
arco-pro_production-mode_persistent-cold + rss memory 665 MiB ± 31.6 MiB 671 MiB ± 21.9 MiB +0.95 %
arco-pro_production-mode_persistent-hot + rss memory 502 MiB ± 64.7 MiB 525 MiB ± 65.1 MiB +4.54 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 592 MiB ± 104 MiB 610 MiB ± 53 MiB +3.13 %
large-dyn-imports_development-mode + rss memory 601 MiB ± 3.66 MiB 601 MiB ± 3.27 MiB +0.07 %
large-dyn-imports_production-mode + rss memory 544 MiB ± 13.3 MiB 540 MiB ± 8.86 MiB -0.71 %
threejs_development-mode_10x + rss memory 529 MiB ± 19.4 MiB 529 MiB ± 29.3 MiB -0.02 %
threejs_development-mode_10x_hmr + rss memory 757 MiB ± 65.1 MiB 753 MiB ± 74.1 MiB -0.51 %
threejs_production-mode_10x + rss memory 696 MiB ± 69.2 MiB 708 MiB ± 64.1 MiB +1.81 %
threejs_production-mode_10x_persistent-cold + rss memory 748 MiB ± 25.6 MiB 731 MiB ± 37.4 MiB -2.23 %
threejs_production-mode_10x_persistent-hot + rss memory 583 MiB ± 46.5 MiB 614 MiB ± 106 MiB +5.29 %

Copy link
Contributor

Copilot AI left a comment

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 refactors the persistent cache snapshot strategy system by extracting helper functionality into dedicated modules (hash_helper.rs and package_helper.rs) and adds a new test case for context dependencies. The refactoring encapsulates cache management within helper classes, addressing issues with cache invalidation when watching context dependency changes.

Key changes:

  • Extracted content hash computation logic into a dedicated HashHelper module
  • Extracted package version resolution logic into a dedicated PackageHelper module
  • Added comprehensive test coverage for the new helper modules
  • Added new test case for snapshot context dependencies behavior

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
crates/rspack_core/src/cache/persistent/snapshot/strategy/mod.rs Refactored to use new helper modules, simplified by delegating to PackageHelper and HashHelper
crates/rspack_core/src/cache/persistent/snapshot/strategy/hash_helper.rs New module for computing content hashes with caching and support for both files and directories
crates/rspack_core/src/cache/persistent/snapshot/strategy/package_helper.rs New module for finding package.json versions with directory traversal and caching
tests/rspack-test/cacheCases/snapshot/context-dependencies/index.js Test case for context dependencies cache invalidation behavior
tests/rspack-test/cacheCases/snapshot/context-dependencies/rspack.config.js Configuration for context dependencies test
tests/rspack-test/cacheCases/snapshot/context-dependencies/loader.js Loader that adds context dependencies
tests/rspack-test/cacheCases/snapshot/context-dependencies/file.js Test fixture with multiple versions

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

crates/rspack_core/src/cache/persistent/snapshot/strategy/mod.rs:60

  • [nitpick] The fs Arc is cloned three times here. Consider cloning once and reusing the cloned value, or pass references to the helpers if feasible. While Arc::clone is relatively cheap, this pattern could be optimized.

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

@github-actions
Copy link
Contributor

📦 Binary Size-limit

Comparing 5dbcedb to refactor: render runtime root variables by runtime template (#12308) by harpsealjs

❌ Size increased by 3.50KB from 47.68MB to 47.68MB (⬆️0.01%)

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 27, 2025

CodSpeed Performance Report

Merging #12309 will not alter performance

Comparing jerry/cd (5dbcedb) with main (4322519)

Summary

✅ 17 untouched

@jerrykingxyz jerrykingxyz merged commit 25e1f67 into main Nov 27, 2025
47 checks passed
@jerrykingxyz jerrykingxyz deleted the jerry/cd branch November 27, 2025 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: bug fix release: bug 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.

3 participants