-
-
Notifications
You must be signed in to change notification settings - Fork 677
perf: introduce ModuleGraphCache
and cache the result of get_mode
and determine_export_assignments
#10584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
LingyuCoder
merged 18 commits into
web-infra-dev:main
from
CPunisher:06-04-perf/cache-get-mode
Jun 12, 2025
Merged
perf: introduce ModuleGraphCache
and cache the result of get_mode
and determine_export_assignments
#10584
LingyuCoder
merged 18 commits into
web-infra-dev:main
from
CPunisher:06-04-perf/cache-get-mode
Jun 12, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ Deploy Preview for rspack ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
This comment was marked as outdated.
This comment was marked as outdated.
5ac555b
to
f075ac8
Compare
CodSpeed Performance ReportMerging #10584 will not alter performanceComparing Summary
|
ab3aab4
to
b879b9d
Compare
📝 Benchmark detail: Open
|
91c0fc2
to
eadc307
Compare
LingyuCoder
approved these changes
Jun 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
jerrykingxyz
approved these changes
Jun 12, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Related: web-infra-dev/rslib#1011
In my M3Pro:
Most changed files are due to the trait method signature changes and passing
module_graph_cache
, you may only need to focus on the following files:crates/rspack_core/src/compiler/compilation.rs
crates/rspack_core/src/artifacts/module_graph_cache_artifact.rs
crates/rspack_plugin_javascript/src/dependency/esm/esm_export_imported_specifier_dependency.rs
freeze()
Compare with Webpack
getMode
withdependencyCacheProvide
(https://github.com/webpack/webpack/blob/19ca74127f7668aaf60d59f4af8fcaee7924541a/lib/ModuleGraph.js#L829). But it seems that rspack doesn't port themoduleMemCache
. I'm not sure this is a further optimization or a fallback for correctness.DetermineExportAssginments
are different, see the comments https://github.com/web-infra-dev/rspack/pull/10584/files#diff-24cb30e171ddb52a6fa8ee0070a832ad5164167b770ffd8c3b8def27cd3becd2R112To validate the cache effectiveness, I collect the cache stats:
Not sure why webpack execute
GetMode
for 2000 times more than rspackFurther
There are still improvements to do, but I'd like to finish them in separated prs
ExportsMode
. From my observationExportsMode
can split to variants to reduce the struct size, thus making it cheaper to clone from the cache.Checklist