perf: parallel process exports spec#11110
Conversation
✅ Deploy Preview for rspack canceled.
|
📦 Binary Size-limit
❌ Size increased by 23.38KB from 48.97MB to 48.99MB (⬆️0.05%) |
CodSpeed Performance ReportMerging #11110 will not alter performanceComparing 🎉 Hooray!
|
bc11861 to
bddc4d2
Compare
bddc4d2 to
b1926d6
Compare
There was a problem hiding this comment.
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))| {
crates/rspack_plugin_javascript/src/plugin/flag_dependency_exports_plugin.rs
Outdated
Show resolved
Hide resolved
crates/rspack_plugin_javascript/src/plugin/flag_dependency_exports_plugin.rs
Outdated
Show resolved
Hide resolved
crates/rspack_plugin_javascript/src/plugin/flag_dependency_exports_plugin.rs
Outdated
Show resolved
Hide resolved
crates/rspack_plugin_javascript/src/plugin/flag_dependency_exports_plugin.rs
Outdated
Show resolved
Hide resolved
…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>
6983b70 to
0598c93
Compare
Summary
Parallelize process exports specs when:
redirect_toexportswhich will only be used in cjs interop and json nested objectsThis 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:

After:

Related links
Checklist