Skip to content

feat: optimize generated getter for const export #14045

Merged
ahabhgk merged 4 commits into
mainfrom
optimize-getter
May 21, 2026
Merged

feat: optimize generated getter for const export #14045
ahabhgk merged 4 commits into
mainfrom
optimize-getter

Conversation

@ahabhgk

@ahabhgk ahabhgk commented May 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Optimize ESM export const codegen by emitting value bindings in __webpack_require__.d instead of generated getter functions when circular-module information is available and the current module is not circular.
  • Keep getter bindings for non-const exports and circular modules, and place circular modules' __webpack_require__.d calls at the top while non-circular modules emit them at the end of the module body.
  • Update the __webpack_require__.d runtime binding format to support flat definitions like 'name', 0, value for value exports and 'name', () => value for getter exports.
  • Enable CircularModulesInfoPlugin only for production/default-production mode, and store circular-module info as Option<IdentifierSet> so an empty set still means the plugin ran and the optimization can apply.
  • Update related runtime interop handling and snapshots for the new export-definition format.

Related links

Checklist

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

@github-actions

github-actions Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing 84227ce to perf: remove unnecessary async_trait usage (#14041) by hardfist

❌ Size increased by 4.00KB from 61.92MB to 61.92MB (⬆️0.01%)

@github-actions

github-actions Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

⚠️ Note: The latest commit (826d6c3aed) does not have baseline artifacts. Using commit c050e8fdb4 for baseline comparison instead. If this seems incorrect, please wait a few minutes and try rerunning the workflow.

Found 6 projects in monorepo, 6 projects with changes.

📊 Quick Summary
Project Total Size Change
popular-libs 1.7 MB +2.2 KB (0.1%)
react-10k 5.7 MB +16.0 KB (0.3%)
react-1k 827.2 KB +951.0 B (0.1%)
rome 1.6 MB +64.0 B (0.0%)
react-5k 2.7 MB +7.0 KB (0.3%)
ui-components 4.8 MB +283.0 B (0.0%)
📋 Detailed Reports (Click to expand)

📁 popular-libs

Path: ../build-tools-performance/cases/popular-libs/dist/rsdoctor-data.json

📌 Baseline Commit: c050e8fdb4 | PR: #14041

Metric Current Baseline Change
📊 Total Size 1.7 MB 1.7 MB +2.2 KB (0.1%)
📄 JavaScript 1.7 MB 1.7 MB +2.2 KB (0.1%)
🎨 CSS 0 B 0 B 0
🌐 HTML 289.0 B 289.0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: popular-libs Bundle Diff

📁 react-10k

Path: ../build-tools-performance/cases/react-10k/dist/rsdoctor-data.json

📌 Baseline Commit: c050e8fdb4 | PR: #14041

Metric Current Baseline Change
📊 Total Size 5.7 MB 5.7 MB +16.0 KB (0.3%)
📄 JavaScript 5.7 MB 5.7 MB +16.0 KB (0.3%)
🎨 CSS 21.0 B 21.0 B 0
🌐 HTML 328.0 B 328.0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: react-10k Bundle Diff

📁 react-1k

Path: ../build-tools-performance/cases/react-1k/dist/rsdoctor-data.json

📌 Baseline Commit: c050e8fdb4 | PR: #14041

Metric Current Baseline Change
📊 Total Size 827.2 KB 826.3 KB +951.0 B (0.1%)
📄 JavaScript 826.9 KB 826.0 KB +951.0 B (0.1%)
🎨 CSS 0 B 0 B 0
🌐 HTML 328.0 B 328.0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: react-1k Bundle Diff

📁 rome

Path: ../build-tools-performance/cases/rome/dist/rsdoctor-data.json

📌 Baseline Commit: c050e8fdb4 | PR: #14041

Metric Current Baseline Change
📊 Total Size 1.6 MB 1.6 MB +64.0 B (0.0%)
📄 JavaScript 1.6 MB 1.6 MB +64.0 B (0.0%)
🎨 CSS 0 B 0 B 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: rome Bundle Diff

📁 react-5k

Path: ../build-tools-performance/cases/react-5k/dist/rsdoctor-data.json

📌 Baseline Commit: c050e8fdb4 | PR: #14041

Metric Current Baseline Change
📊 Total Size 2.7 MB 2.7 MB +7.0 KB (0.3%)
📄 JavaScript 2.7 MB 2.7 MB +7.0 KB (0.3%)
🎨 CSS 21.0 B 21.0 B 0
🌐 HTML 328.0 B 328.0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: react-5k Bundle Diff

📁 ui-components

Path: ../build-tools-performance/cases/ui-components/dist/rsdoctor-data.json

📌 Baseline Commit: c050e8fdb4 | PR: #14041

Metric Current Baseline Change
📊 Total Size 4.8 MB 4.8 MB +283.0 B (0.0%)
📄 JavaScript 4.7 MB 4.7 MB +283.0 B (0.0%)
🎨 CSS 107.0 KB 107.0 KB 0
🌐 HTML 328.0 B 328.0 B 0
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: ui-components Bundle Diff

Generated by Rsdoctor GitHub Action

@codspeed-hq

codspeed-hq Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

⚡ 1 improved benchmark
❌ 1 (👁 1) regressed benchmark
✅ 34 untouched benchmarks
⏩ 25 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
👁 Simulation rust@persistent_cache_restore_after_single_file_change@basic-react-development 16.6 ms 17.2 ms -3.59%
Simulation rust@create_full_hash 6.2 ms 6.1 ms +2.28%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing optimize-getter (84227ce) with main (c050e8f)

Open in CodSpeed

Footnotes

  1. 25 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@ahabhgk ahabhgk mentioned this pull request May 18, 2026
2 tasks
@ahabhgk ahabhgk force-pushed the optimize-getter branch from 2493eba to 262755a Compare May 19, 2026 09:20
@github-actions

This comment was marked as outdated.

@github-actions

github-actions Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

📝 Benchmark detail: Open

Name Base (9ceba09) Current Change
10000_big_production-mode_disable-minimize + exec 13.3 s ± 284 ms 13.2 s ± 197 ms -0.50 %
10000_development-mode + exec 879 ms ± 27 ms 880 ms ± 15 ms +0.14 %
10000_development-mode_hmr + stats 160 ms ± 5.2 ms 162 ms ± 9.2 ms +0.69 %
10000_development-mode_noop-loader + exec 1.95 s ± 46 ms 1.95 s ± 94 ms -0.13 %
10000_production-mode + exec 990 ms ± 48 ms 996 ms ± 28 ms +0.63 %
10000_production-mode_persistent-cold + exec 1.15 s ± 13 ms 1.18 s ± 20 ms +2.76 %
10000_production-mode_persistent-hot + exec 591 ms ± 11 ms 611 ms ± 12 ms +3.39 %
10000_production-mode_source-map + exec 1.16 s ± 48 ms 1.18 s ± 40 ms +1.41 %
arco-pro_development-mode + exec 1.32 s ± 66 ms 1.3 s ± 82 ms -1.86 %
arco-pro_development-mode_hmr + stats 34 ms ± 0.69 ms 34 ms ± 1.1 ms +1.03 %
arco-pro_production-mode + exec 2.37 s ± 82 ms 2.38 s ± 67 ms +0.51 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 2.39 s ± 79 ms 2.44 s ± 93 ms +1.87 %
arco-pro_production-mode_persistent-cold + exec 2.43 s ± 133 ms 2.42 s ± 34 ms -0.37 %
arco-pro_production-mode_persistent-hot + exec 341 ms ± 7.1 ms 345 ms ± 11 ms +1.05 %
arco-pro_production-mode_source-map + exec 2.83 s ± 153 ms 2.81 s ± 113 ms -0.82 %
arco-pro_production-mode_traverse-chunk-modules + exec 2.43 s ± 164 ms 2.42 s ± 46 ms -0.43 %
bundled-threejs_development-mode + exec 181 ms ± 6.5 ms 182 ms ± 5.6 ms +0.33 %
bundled-threejs_production-mode + exec 210 ms ± 7.2 ms 209 ms ± 4.4 ms -0.48 %
large-dyn-imports_development-mode + exec 1.12 s ± 13 ms 1.12 s ± 25 ms +0.48 %
large-dyn-imports_production-mode + exec 1.24 s ± 59 ms 1.28 s ± 39 ms +3.56 %
threejs_development-mode_10x + exec 807 ms ± 23 ms 818 ms ± 17 ms +1.31 %
threejs_development-mode_10x_hmr + stats 109 ms ± 2.8 ms 109 ms ± 2.9 ms +0.47 %
threejs_production-mode_10x + exec 2.83 s ± 58 ms 2.85 s ± 28 ms +0.82 %
threejs_production-mode_10x_persistent-cold + exec 2.97 s ± 97 ms 3.01 s ± 28 ms +1.31 %
threejs_production-mode_10x_persistent-hot + exec 384 ms ± 3.6 ms 392 ms ± 2.9 ms +1.98 %
threejs_production-mode_10x_source-map + exec 3.58 s ± 60 ms 3.62 s ± 44 ms +1.11 %
10000_big_production-mode_disable-minimize + rss memory 2001 MiB ± 55.9 MiB 1983 MiB ± 36 MiB -0.90 %
10000_development-mode + rss memory 591 MiB ± 17.7 MiB 592 MiB ± 18.6 MiB +0.14 %
10000_development-mode_hmr + rss memory 802 MiB ± 52.2 MiB 800 MiB ± 39.8 MiB -0.24 %
10000_development-mode_noop-loader + rss memory 888 MiB ± 18 MiB 886 MiB ± 9.19 MiB -0.21 %
10000_production-mode + rss memory 544 MiB ± 12.6 MiB 543 MiB ± 7.57 MiB -0.17 %
10000_production-mode_persistent-cold + rss memory 715 MiB ± 10.9 MiB 711 MiB ± 7.45 MiB -0.59 %
10000_production-mode_persistent-hot + rss memory 627 MiB ± 16.5 MiB 625 MiB ± 11 MiB -0.31 %
10000_production-mode_source-map + rss memory 537 MiB ± 47.1 MiB 543 MiB ± 29.6 MiB +1.24 %
arco-pro_development-mode + rss memory 484 MiB ± 12.8 MiB 484 MiB ± 8.38 MiB +0.07 %
arco-pro_development-mode_hmr + rss memory 499 MiB ± 3.41 MiB 499 MiB ± 6.62 MiB +0.02 %
arco-pro_production-mode + rss memory 664 MiB ± 71.2 MiB 680 MiB ± 21.2 MiB +2.30 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 693 MiB ± 14.1 MiB 698 MiB ± 16 MiB +0.70 %
arco-pro_production-mode_persistent-cold + rss memory 745 MiB ± 7.55 MiB 742 MiB ± 17.2 MiB -0.40 %
arco-pro_production-mode_persistent-hot + rss memory 367 MiB ± 16.9 MiB 368 MiB ± 14 MiB +0.07 %
arco-pro_production-mode_source-map + rss memory 767 MiB ± 24.7 MiB 763 MiB ± 23.6 MiB -0.57 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 678 MiB ± 23.9 MiB 687 MiB ± 15.2 MiB +1.35 %
bundled-threejs_development-mode + rss memory 153 MiB ± 7.35 MiB 154 MiB ± 5.25 MiB +1.12 %
bundled-threejs_production-mode + rss memory 178 MiB ± 7.26 MiB 177 MiB ± 8.92 MiB -0.76 %
large-dyn-imports_development-mode + rss memory 597 MiB ± 4.94 MiB 592 MiB ± 23.2 MiB -0.81 %
large-dyn-imports_production-mode + rss memory 462 MiB ± 12.7 MiB 460 MiB ± 4.25 MiB -0.43 %
threejs_development-mode_10x + rss memory 542 MiB ± 19.7 MiB 538 MiB ± 14.9 MiB -0.80 %
threejs_development-mode_10x_hmr + rss memory 675 MiB ± 19 MiB 675 MiB ± 9 MiB +0.03 %
threejs_production-mode_10x + rss memory 720 MiB ± 15.6 MiB 712 MiB ± 10.8 MiB -1.14 %
threejs_production-mode_10x_persistent-cold + rss memory 675 MiB ± 16.9 MiB 665 MiB ± 4.71 MiB -1.44 %
threejs_production-mode_10x_persistent-hot + rss memory 472 MiB ± 15 MiB 472 MiB ± 3.75 MiB -0.09 %
threejs_production-mode_10x_source-map + rss memory 828 MiB ± 24.1 MiB 842 MiB ± 26.3 MiB +1.74 %

Base persistent cache hit rate:

  • 10000_production-mode_persistent-cold: 0.00%
  • arco-pro_production-mode_persistent-cold: 0.00%
  • threejs_production-mode_10x_persistent-cold: 0.00%
    Current persistent cache hit rate:
  • 10000_production-mode_persistent-cold: 0.00%
  • arco-pro_production-mode_persistent-cold: 0.00%
  • threejs_production-mode_10x_persistent-cold: 0.00%

@ahabhgk ahabhgk marked this pull request as ready for review May 20, 2026 10:33
Copilot AI review requested due to automatic review settings May 20, 2026 10:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@ahabhgk

ahabhgk commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ahabhgk ahabhgk merged commit 66c2161 into main May 21, 2026
35 checks passed
@ahabhgk ahabhgk deleted the optimize-getter branch May 21, 2026 07:03
ahabhgk added a commit that referenced this pull request May 26, 2026
ahabhgk added a commit that referenced this pull request May 26, 2026
Revert "feat: optimize generated getter for const export  (#14045)"

This reverts commit 66c2161.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants