Skip to content

refactor: prefetch exports info data of getters part 2#10576

Merged
LingyuCoder merged 21 commits intomainfrom
refactor/exports-info-getter-2
Jun 11, 2025
Merged

refactor: prefetch exports info data of getters part 2#10576
LingyuCoder merged 21 commits intomainfrom
refactor/exports-info-getter-2

Conversation

@LingyuCoder
Copy link
Contributor

@LingyuCoder LingyuCoder commented Jun 5, 2025

Summary

Introduce the PrefetchExportsInfoMode to 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:

  • Default: prefetch without any named ExportInfo, only prefetch redirect_to, other, side effects
  • NamedExports(names): prefetch with named ExportInfos but no nested ExportsInfo
  • AllExports: prefetch all named ExportInfos but no nested Exports
  • NamedNestedExports(nestedNames): prefetch with a named ExportInfo and its nested ExportsInfo chain
  • NamedNestedAllExports(nestedNames): prefetch with all named nested ExportsInfo and all ExportInfos on the chain

And 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.

The getMode related methods is not removed due to performance issues. Adding it will be considered later after the getMode cache is completed.

Checklist

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

Copy link
Contributor Author

LingyuCoder commented Jun 5, 2025

@LingyuCoder LingyuCoder changed the title refactor: nested exports info data of getters part 2 refactor: prefetched exports info data of getters part 2 Jun 5, 2025
@LingyuCoder LingyuCoder changed the title refactor: prefetched exports info data of getters part 2 refactor: prefetch exports info data of getters part 2 Jun 5, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Jun 5, 2025

CodSpeed Performance Report

Merging #10576 will not alter performance

Comparing refactor/exports-info-getter-2 (a8a38b0) with main (0537d82)

Summary

✅ 12 untouched benchmarks

Base automatically changed from refactor/exports-info-getter to main June 5, 2025 03:48
@netlify
Copy link

netlify bot commented Jun 5, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit a8a38b0
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/684938fd2c342000089d21f3

@LingyuCoder LingyuCoder force-pushed the refactor/exports-info-getter-2 branch 2 times, most recently from 133df38 to 0f1a693 Compare June 5, 2025 09:45
@web-infra-dev web-infra-dev deleted a comment from github-actions bot Jun 5, 2025
@LingyuCoder LingyuCoder force-pushed the refactor/exports-info-getter-2 branch from c8a0d00 to 667e371 Compare June 5, 2025 11:05
@web-infra-dev web-infra-dev deleted a comment from github-actions bot Jun 5, 2025
@LingyuCoder LingyuCoder force-pushed the refactor/exports-info-getter-2 branch from 667e371 to 62a4db5 Compare June 5, 2025 12:14
@web-infra-dev web-infra-dev deleted a comment from github-actions bot Jun 5, 2025
@LingyuCoder LingyuCoder force-pushed the refactor/exports-info-getter-2 branch from 62a4db5 to aa63c5a Compare June 6, 2025 03:16
@web-infra-dev web-infra-dev deleted a comment from github-actions bot Jun 6, 2025
@web-infra-dev web-infra-dev deleted a comment from github-actions bot Jun 6, 2025
@web-infra-dev web-infra-dev deleted a comment from github-actions bot Jun 9, 2025
@web-infra-dev web-infra-dev deleted a comment from github-actions bot Jun 9, 2025
@LingyuCoder LingyuCoder force-pushed the refactor/exports-info-getter-2 branch from e0873f0 to 2ae6c77 Compare June 9, 2025 14:59
@web-infra-dev web-infra-dev deleted a comment from github-actions bot Jun 9, 2025
@web-infra-dev web-infra-dev deleted a comment from github-actions bot Jun 9, 2025
@LingyuCoder LingyuCoder force-pushed the refactor/exports-info-getter-2 branch from eecf65e to 4035342 Compare June 9, 2025 17:11
@web-infra-dev web-infra-dev deleted a comment from github-actions bot Jun 9, 2025
@web-infra-dev web-infra-dev deleted a comment from github-actions bot Jun 10, 2025
@web-infra-dev web-infra-dev deleted a comment from github-actions bot Jun 10, 2025
@LingyuCoder LingyuCoder force-pushed the refactor/exports-info-getter-2 branch from 4b6427c to ce08850 Compare June 11, 2025 03:51
@github-actions
Copy link
Contributor

github-actions bot commented Jun 11, 2025

📝 Benchmark detail: Open

Name Base (2025-06-10 be68071) Current Change
10000_big_production-mode_disable-minimize + exec 35.4 s ± 260 ms 35.8 s ± 440 ms +1.20 %
10000_development-mode + exec 1.89 s ± 12 ms 1.82 s ± 27 ms -3.65 %
10000_development-mode_hmr + exec 769 ms ± 4.8 ms 696 ms ± 31 ms -9.42 %
10000_production-mode + exec 2.3 s ± 21 ms 2.33 s ± 133 ms +1.22 %
10000_production-mode_persistent-cold + exec 2.46 s ± 47 ms 2.49 s ± 62 ms +1.31 %
10000_production-mode_persistent-hot + exec 1.73 s ± 48 ms 1.79 s ± 45 ms +3.72 %
arco-pro_development-mode + exec 1.8 s ± 68 ms 1.79 s ± 67 ms -0.43 %
arco-pro_development-mode_hmr + exec 386 ms ± 1.6 ms 370 ms ± 2.1 ms -4.11 %
arco-pro_production-mode + exec 3.4 s ± 43 ms 3.35 s ± 120 ms -1.62 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.45 s ± 121 ms 3.46 s ± 148 ms +0.48 %
arco-pro_production-mode_persistent-cold + exec 3.46 s ± 87 ms 3.42 s ± 99 ms -1.04 %
arco-pro_production-mode_persistent-hot + exec 2.08 s ± 128 ms 2.04 s ± 58 ms -1.95 %
arco-pro_production-mode_traverse-chunk-modules + exec 3.42 s ± 70 ms 3.37 s ± 65 ms -1.56 %
large-dyn-imports_development-mode + exec 2.17 s ± 270 ms 2.08 s ± 32 ms -3.91 %
large-dyn-imports_production-mode + exec 2.09 s ± 44 ms 2.1 s ± 34 ms +0.11 %
threejs_development-mode_10x + exec 1.48 s ± 38 ms 1.46 s ± 27 ms -1.34 %
threejs_development-mode_10x_hmr + exec 877 ms ± 30 ms 834 ms ± 18 ms -4.93 %
threejs_production-mode_10x + exec 4.81 s ± 25 ms 4.8 s ± 50 ms -0.11 %
threejs_production-mode_10x_persistent-cold + exec 5.03 s ± 400 ms 4.91 s ± 75 ms -2.36 %
threejs_production-mode_10x_persistent-hot + exec 4.28 s ± 154 ms 4.3 s ± 342 ms +0.26 %
10000_big_production-mode_disable-minimize + rss memory 9378 MiB ± 494 MiB 9153 MiB ± 54.7 MiB -2.40 %
10000_development-mode + rss memory 648 MiB ± 17.3 MiB 647 MiB ± 20.7 MiB -0.08 %
10000_development-mode_hmr + rss memory 786 MiB ± 17.7 MiB 775 MiB ± 14.4 MiB -1.35 %
10000_production-mode + rss memory 650 MiB ± 31.8 MiB 656 MiB ± 44.6 MiB +0.96 %
10000_production-mode_persistent-cold + rss memory 754 MiB ± 46.8 MiB 757 MiB ± 35.4 MiB +0.42 %
10000_production-mode_persistent-hot + rss memory 745 MiB ± 18.7 MiB 763 MiB ± 37.3 MiB +2.41 %
arco-pro_development-mode + rss memory 574 MiB ± 59 MiB 609 MiB ± 20.3 MiB +6.07 %
arco-pro_development-mode_hmr + rss memory 478 MiB ± 29.7 MiB 496 MiB ± 46.2 MiB +3.60 %
arco-pro_production-mode + rss memory 698 MiB ± 93.8 MiB 707 MiB ± 47.2 MiB +1.33 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 702 MiB ± 85.4 MiB 714 MiB ± 27.9 MiB +1.66 %
arco-pro_production-mode_persistent-cold + rss memory 808 MiB ± 131 MiB 775 MiB ± 58.7 MiB -4.13 %
arco-pro_production-mode_persistent-hot + rss memory 678 MiB ± 27.8 MiB 660 MiB ± 56.2 MiB -2.56 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 682 MiB ± 44.3 MiB 699 MiB ± 76.6 MiB +2.45 %
large-dyn-imports_development-mode + rss memory 660 MiB ± 3.93 MiB 666 MiB ± 7.94 MiB +0.90 %
large-dyn-imports_production-mode + rss memory 547 MiB ± 4.99 MiB 549 MiB ± 4.53 MiB +0.26 %
threejs_development-mode_10x + rss memory 619 MiB ± 8.55 MiB 619 MiB ± 17.5 MiB +0.07 %
threejs_development-mode_10x_hmr + rss memory 808 MiB ± 78.6 MiB 778 MiB ± 72.6 MiB -3.69 %
threejs_production-mode_10x + rss memory 870 MiB ± 54 MiB 864 MiB ± 44.8 MiB -0.68 %
threejs_production-mode_10x_persistent-cold + rss memory 978 MiB ± 61 MiB 977 MiB ± 34.6 MiB -0.05 %
threejs_production-mode_10x_persistent-hot + rss memory 838 MiB ± 44.7 MiB 817 MiB ± 14.9 MiB -2.47 %

@LingyuCoder LingyuCoder marked this pull request as ready for review June 11, 2025 06:07
@LingyuCoder LingyuCoder requested review from JSerFeng and ahabhgk June 11, 2025 06:07
@web-infra-dev web-infra-dev deleted a comment from github-actions bot Jun 11, 2025
@web-infra-dev web-infra-dev deleted a comment from github-actions bot Jun 11, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jun 11, 2025

📝 Ecosystem CI detail: Open

suite result
modernjs ❌ failure
rslib ❌ failure
rsbuild ❌ failure
rspress ✅ success
devserver ❌ failure
nuxt ✅ success
examples ✅ success
rsdoctor ❌ failure
plugin ✅ success
lynx-stack ✅ success

Copy link
Contributor

@ahabhgk ahabhgk left a comment

Choose a reason for hiding this comment

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

I'm ok with this, @JSerFeng what do you think?

@LingyuCoder LingyuCoder merged commit 9042aad into main Jun 11, 2025
35 checks passed
@LingyuCoder LingyuCoder deleted the refactor/exports-info-getter-2 branch June 11, 2025 09:21
@LingyuCoder
Copy link
Contributor Author

I'm ok with this, @JSerFeng what do you think?

Did not see this comment before merging 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants