Skip to content

perf: parallel process exports spec#11110

Merged
LingyuCoder merged 13 commits intomainfrom
perf/parallel-process-exports-spec
Jul 23, 2025
Merged

perf: parallel process exports spec#11110
LingyuCoder merged 13 commits intomainfrom
perf/parallel-process-exports-spec

Conversation

@LingyuCoder
Copy link
Contributor

@LingyuCoder LingyuCoder commented Jul 21, 2025

Summary

Parallelize process exports specs when:

  • the exports info data does not have redirect_to
  • the exports specs do not have nested exports which will only be used in cjs interop and json nested objects

This means only the module's direct exports info data will be modified and the modules can be distinct by module_ids, so they can be modified parallelly.

Before:
image

After:
image

Related links

Checklist

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

@netlify
Copy link

netlify bot commented Jul 21, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 0598c93
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/68805a31d12f1300089161c5

@github-actions github-actions bot added release: performance release: performance related release(mr only) team The issue/pr is created by the member of Rspack. labels Jul 21, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jul 21, 2025

📦 Binary Size-limit

Comparing 0598c93 to fix(parser): do not skip parsing expression inside require.resolve (#11133) by Wei

❌ Size increased by 23.38KB from 48.97MB to 48.99MB (⬆️0.05%)

@codspeed-hq
Copy link

codspeed-hq bot commented Jul 21, 2025

CodSpeed Performance Report

Merging #11110 will not alter performance

Comparing perf/parallel-process-exports-spec (0598c93) with main (7f849d6)

🎉 Hooray! codspeed-rust just leveled up to 2.7.2!

A heads-up, this is a breaking change and it might affect your current performance baseline a bit. But here's the exciting part - it's packed with new, cool features and promises improved result stability 🥳!
Curious about what's new? Visit our releases page to delve into all the awesome details about this new version.

Summary

✅ 16 untouched benchmarks

@LingyuCoder LingyuCoder force-pushed the perf/parallel-process-exports-spec branch from bc11861 to bddc4d2 Compare July 21, 2025 08:26
@github-actions
Copy link
Contributor

github-actions bot commented Jul 21, 2025

📝 Ecosystem CI detail: Open

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

@web-infra-dev web-infra-dev deleted a comment from github-actions bot Jul 21, 2025
@web-infra-dev web-infra-dev deleted a comment from github-actions bot Jul 21, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jul 21, 2025

📝 Ecosystem CI detail: Open

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

@LingyuCoder LingyuCoder force-pushed the perf/parallel-process-exports-spec branch from bddc4d2 to b1926d6 Compare July 23, 2025 03:18
@LingyuCoder LingyuCoder marked this pull request as ready for review July 23, 2025 03:19
Copilot AI review requested due to automatic review settings July 23, 2025 03:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR optimizes the performance of the exports specification processing in the flag_dependency_exports_plugin by introducing parallel processing for non-nested export specifications. The optimization partitions export specs into parallel-safe and sequential processing paths based on whether they contain nested exports or redirects.

  • Introduces parallel processing for export specs that don't have nested exports or redirects
  • Refactors the existing sequential processing logic into separate functions for better maintainability
  • Adds new methods to support parallel-safe operations on exports info data

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
flag_dependency_exports_plugin.rs Major refactoring to implement parallel processing logic and extract helper functions
exports_info_setter.rs Adds new methods for parallel-safe operations on exports info data
exports_info.rs Moves set_all_known_exports_used method to setter module
export_info_setter.rs Removes unused create_nested_exports_info method
export_property_library_plugin.rs Updates method call to use moved function
dependency/mod.rs Adds helper method to detect nested exports
Comments suppressed due to low confidence (2)

crates/rspack_plugin_javascript/src/plugin/flag_dependency_exports_plugin.rs:239

  • [nitpick] The return type tuple (FxIndexMap<DependencyId, ExportsSpec>, bool) would be clearer with a descriptive struct or type alias. Consider creating a struct like ExportsSpecsResult { specs: FxIndexMap<DependencyId, ExportsSpec>, has_nested: bool }
) -> Option<(FxIndexMap<DependencyId, ExportsSpec>, bool)> {

crates/rspack_plugin_javascript/src/plugin/flag_dependency_exports_plugin.rs:88

  • The variable name 'mid' is ambiguous and could be confused with 'middle'. Consider renaming to 'module_id' for clarity.
        .partition(|(mid, (_, has_nested_exports))| {

LingyuCoder and others added 8 commits July 23, 2025 11:21
…orts_plugin.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…orts_plugin.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…orts_plugin.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…orts_plugin.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@LingyuCoder LingyuCoder enabled auto-merge (squash) July 23, 2025 03:28
@LingyuCoder LingyuCoder force-pushed the perf/parallel-process-exports-spec branch from 6983b70 to 0598c93 Compare July 23, 2025 03:42
@github-actions
Copy link
Contributor

github-actions bot commented Jul 23, 2025

📝 Ecosystem CI detail: Open

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

@LingyuCoder LingyuCoder requested review from JSerFeng and ahabhgk July 23, 2025 04:25
@github-actions
Copy link
Contributor

github-actions bot commented Jul 23, 2025

📝 Ecosystem CI detail: Open

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

@LingyuCoder LingyuCoder merged commit 9232f5f into main Jul 23, 2025
46 checks passed
@LingyuCoder LingyuCoder deleted the perf/parallel-process-exports-spec branch July 23, 2025 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: performance release: performance related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants