refactor: prefetch exports info data of getters part 2#10576
Merged
LingyuCoder merged 21 commits intomainfrom Jun 11, 2025
Merged
refactor: prefetch exports info data of getters part 2#10576LingyuCoder merged 21 commits intomainfrom
LingyuCoder merged 21 commits intomainfrom
Conversation
This was referenced Jun 5, 2025
2 tasks
Contributor
Author
CodSpeed Performance ReportMerging #10576 will not alter performanceComparing Summary
|
✅ Deploy Preview for rspack canceled.
|
133df38 to
0f1a693
Compare
c8a0d00 to
667e371
Compare
667e371 to
62a4db5
Compare
62a4db5 to
aa63c5a
Compare
e0873f0 to
2ae6c77
Compare
eecf65e to
4035342
Compare
4b6427c to
ce08850
Compare
Contributor
|
📝 Benchmark detail: Open
|
Contributor
Contributor
Author
Did not see this comment before merging 😂 |
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
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
Introduce the
PrefetchExportsInfoModeto limit the data scope of ExportsInfo, thereby reducing the performance consumption caused by unnecessary data prefetching. Since there is an infinite hierarchical nesting relationship between ExportsInfo and ExportInfo, but when consuming, local data is usually consumed based on Names. Therefore, the following modes are provided:NamedExports(names): prefetch with named ExportInfos but no nested ExportsInfoAllExports: prefetch all named ExportInfos but no nested ExportsNamedNestedExports(nestedNames): prefetch with a named ExportInfo and its nested ExportsInfo chainNamedNestedAllExports(nestedNames): prefetch with all named nested ExportsInfo and all ExportInfos on the chainAnd the PrefetchedExportsInfoWrapper will get data according to the mode, if any data which is not prefetched is used, it will panic. Therefore, before reading ExportsInfo data, it is necessary to clarify the scope of data usage.
In terms of performance, since it is still need to prefetch more data than the consumption requirements, it may cause some performance degradation. However, as all operations of reading ExportsInfo and ExportInfo no longer need to query through the ID on the module graph, there will also be some performance improvements. And according to the benchmark, there is no significant performance degradation.
At the same time, this PR has made substantial changes to the way of retrieving data of ExportsInfo, and has removed some old methods of obtaining data based on the module graph.
Checklist