Skip to content

perf: optimize ESM library module concatenation - #15081

Closed
LingyuCoder wants to merge 2 commits into
mainfrom
seal/concat-esm-library
Closed

LingyuCoder wants to merge 2 commits into
mainfrom
seal/concat-esm-library

Conversation

@LingyuCoder

Copy link
Copy Markdown
Contributor

Summary

  • Reuse the concatenation scope information collected during make and updated by dependency templates when linking ESM library output.
  • Apply recorded identifier updates and generated top-level symbols before the final ESM link, avoiding the additional concatenated-module parse.
  • Preserve the legacy ESM library linking path when faster module concatenation is disabled.

This PR is stacked on #14852 and should be reviewed and merged after it.

Checks run:

  • cargo check -p rspack_plugin_esm_library
  • pnpm run build:binding:dev
  • pnpm run test -t "esmOutputCases/deconflict"
  • pnpm run test -t "esmOutputCases/worker/new-url-relative"

Related links

Checklist

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

@github-actions

github-actions Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing 14c08eb to chore: update Rstack to v0.6.2 (#15252) by Jiahan Chen

❌ Size increased by 48.00KB from 68.15MB to 68.19MB (⬆️0.07%)

@github-actions

github-actions Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 0 projects with changes.

📊 Quick Summary
Project Total Size Gzip Size Change Gzip Change
popular-libs 1.7 MB 556.5 KB 0 0
react-10k 5.6 MB 1.3 MB 0 0
react-1k 823.1 KB 218.4 KB 0 0
react-5k 2.7 MB 669.3 KB 0 0
ui-components 4.9 MB 1.4 MB 0 0

Generated by Rsdoctor GitHub Action

@codspeed

codspeed Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will degrade performance by 2.01%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 49 untouched benchmarks
⏩ 47 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Simulation rust@mangle_exports 3.1 ms 3.1 ms -2.01%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing seal/concat-esm-library (14c08eb) with main (f7a86ea)

Open in CodSpeed

Footnotes

  1. 47 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. ↩

@LingyuCoder
LingyuCoder force-pushed the seal/concat-esm-library branch 3 times, most recently from b055dc7 to 58c569e Compare August 6, 2026 11:44
@LingyuCoder
LingyuCoder force-pushed the seal/concat-esm-library branch 2 times, most recently from 004aa17 to 131ce67 Compare August 6, 2026 13:49
@LingyuCoder
LingyuCoder force-pushed the seal/concat-esm-library branch 4 times, most recently from 5755934 to 0535be4 Compare August 10, 2026 04:03
@LingyuCoder
LingyuCoder force-pushed the seal/concat-esm-library branch from 0535be4 to c5e329d Compare August 13, 2026 05:31
@LingyuCoder
LingyuCoder force-pushed the seal/concat-esm-library branch from c5e329d to 41075e4 Compare August 14, 2026 04:53
Base automatically changed from seal/concat-local-ident to main August 18, 2026 03:24
@LingyuCoder
LingyuCoder force-pushed the seal/concat-esm-library branch 3 times, most recently from 92855ba to 00e7c85 Compare August 19, 2026 06:26
@LingyuCoder
LingyuCoder marked this pull request as ready for review August 19, 2026 06:46

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 00e7c85e21

ℹ️ 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".

Comment thread crates/rspack_plugin_esm_library/src/plugin.rs
Comment thread crates/rspack_plugin_esm_library/src/link.rs Outdated
@LingyuCoder
LingyuCoder force-pushed the seal/concat-esm-library branch from ee1ab8f to 14c08eb Compare August 20, 2026 10:28

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 14c08ebf2f

ℹ️ 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".

Comment thread crates/rspack_core/src/utils/concatenation_scope.rs
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.

1 participant