-
-
Notifications
You must be signed in to change notification settings - Fork 673
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
base: main
Are you sure you want to change the base?
perf: introduce ModuleGraphCache
and cache the result of get_mode
and determine_export_assignments
#10584
Conversation
✅ Deploy Preview for rspack canceled.Built without sensitive environment variables
|
This comment was marked as outdated.
This comment was marked as outdated.
5ac555b
to
f075ac8
Compare
CodSpeed Performance ReportMerging #10584 will not alter performanceComparing 🎉 Hooray!
|
cb31605
to
ab3aab4
Compare
ab3aab4
to
b879b9d
Compare
📝 Benchmark detail: Open
|
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