refactor: prefetch exports info data of getters part 3#10652
refactor: prefetch exports info data of getters part 3#10652LingyuCoder merged 12 commits intomainfrom
Conversation
✅ Deploy Preview for rspack ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
21d6d37 to
585c448
Compare
CodSpeed Performance ReportMerging #10652 will not alter performanceComparing 🎉 Hooray!
|
| Benchmark | BASE |
HEAD |
Change | |
|---|---|---|---|---|
rust@bundle-basic |
4 ms | N/A | N/A | |
rust@bundle-basic_sourcemap |
4.2 ms | N/A | N/A | |
| 🆕 | bundle@basic-react-development |
N/A | 8.2 ms | N/A |
| 🆕 | bundle@basic-react-production |
N/A | 11.1 ms | N/A |
| 🆕 | bundle@basic-react-production-sourcemap |
N/A | 11.9 ms | N/A |
| 🆕 | bundle@threejs-development |
N/A | 956.4 ms | N/A |
| 🆕 | bundle@threejs-production |
N/A | 1.9 s | N/A |
| 🆕 | bundle@threejs-production-sourcemap |
N/A | 2.4 s | N/A |
50a7d02 to
68568f5
Compare
68568f5 to
5ac9e42
Compare
0eb0228 to
328121c
Compare
328121c to
0a5bacf
Compare
350a1e5 to
84aac7d
Compare
84aac7d to
9bfc925
Compare
|
📝 Benchmark detail: Open
|
3d8d2d1 to
217ccf2
Compare
| .get_used_name(&module_graph, *runtime, ids) | ||
| .map(|used| used.is_inlined()) | ||
| .unwrap_or_default() | ||
| && { |
There was a problem hiding this comment.
I can see there are many similar pattern like this, a few lines of code refactored to many lines of code, can we have a facade function for this pattern, to make more cleaner at the call site, and more easier to use
ahabhgk
left a comment
There was a problem hiding this comment.
Generally looks good to me, a suggestion can resolve in the future PR

Summary
PrefetchedExportsInfoUsedto prevent fetching unnecessary named exports which caused the performance degression. Then modify the param ofget_used_nameto enum to supportPrefetchedExportsInfoUsedfor fast path when the names list is empty.ExportsInfoData/ExportInfoDatato private and provide getter/setter to access them.get_target/find_targetrelated functions toexports/target.rs.exports/referenced_export.rs, and also renameprocess_export_infotocollect_referenced_export_itemsto make the function name more informativeThis pull request introduces multiple changes across several files to enhance the handling of export information and improve code efficiency. The updates include replacing direct field access with getter methods, introducing new enums for clarity, and optimizing hash computation. Below is a breakdown of the most important changes grouped by theme.
Enhancements to Export Information Handling:
ExportInfoDatawith getter methods likeinfo.name()andinfo.global_used()for better encapsulation and maintainability incrates/rspack_core/src/exports/export_info_getter.rs. [1] [2] [3] [4] [5]get_used_nameandget_usedmethods to use the new getter methods, ensuring consistent access patterns. [1] [2]Code Simplification and Refactoring:
GetUsedNameParam::WithNamesfor better parameter clarity inExportsInfoGetter::get_used_namecalls. [1] [2] [3]FindTargetRetEnumwithFindTargetResultfor more descriptive enum variants inimpl ConcatenatedModule.Prefetching and Hash Optimization:
prefetchcalls withprefetch_used_info_without_nameorget_prefetched_exports_infoto improve export information retrieval and reduce unnecessary data fetching. [1] [2] [3] [4] [5]Enum and API Updates:
ExportInfoGettermethods to utilize the new getter-based API for accessing export details, aligning with the encapsulation changes. [1] [2]FindTargetResult.Dependency and Import Adjustments:
PrefetchExportsInfoModeandGetUsedNameParam. [1] [2] [3]These changes collectively improve the codebase's clarity, performance, and maintainability.
Checklist