Conversation
✅ Deploy Preview for rspack canceled.
|
Contributor
📦 Binary Size-limit
🎉 Size decreased by 15.63KB from 49.00MB to 48.98MB (⬇️0.03%) |
CodSpeed Performance ReportMerging #11132 will not alter performanceComparing Summary
|
baae46b to
e702b5e
Compare
e702b5e to
3cf3c57
Compare
Contributor
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements a performance optimization for NAPI communication by changing data serialization strategy from structured objects to JSON strings and introducing memory pooling techniques to reduce allocations.
- Replaces structured data passing with JSON serialization for NAPI communication
- Introduces thread-local buffer pooling to reduce memory allocations
- Optimizes data structure usage by replacing HashMap with UkeyMap for better performance
- Adds caching mechanisms for external item processing
Reviewed Changes
Copilot reviewed 19 out of 21 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/rspack/src/taps/normalModuleFactory.ts | Changes parameter type from JsAfterResolveData to string and adds JSON parsing |
| packages/rspack/src/builtin-plugin/ExternalsPlugin.ts | Adds caching, removes Compiler dependency, and optimizes JSON parsing |
| packages/rspack/etc/core.api.md | Updates API signature to remove Compiler parameter |
| crates/rspack_core/src/module_graph/mod.rs | Replaces HashMap with UkeyMap for dependency-related data structures |
| crates/rspack_binding_api/src/resource_data.rs | Introduces thread-local buffer for property creation |
| crates/rspack_binding_api/src/raw_options/raw_external.rs | Optimizes external item context handling with Arc and async cleanup |
| crates/rspack_binding_api/src/plugins/interceptor.rs | Changes hook to use JSON string serialization |
| crates/rspack_binding_api/src/normal_module_factory.rs | Adds Serialize derive to data structures |
| crates/rspack_binding_api/src/modules/* | Introduces MODULE_PROPERTIES_BUFFER for property reuse |
| crates/rspack_binding_api/src/module_graph.rs | Optimizes connection methods to reuse buffers and return Arrays |
| crates/rspack_binding_api/src/dependency.rs | Optimizes array creation for dependency IDs |
| crates/rspack_binding_api/src/compilation/mod.rs | Optimizes modules getter to return Array directly |
| crates/rspack_binding_api/src/build_info.rs | Introduces thread-local buffer for build info properties |
| crates/rspack_binding_api/Cargo.toml | Adds rayon dependency for async cleanup |
h-a-n-a
approved these changes
Jul 23, 2025
Contributor
stormslowly
added a commit
that referenced
this pull request
Jul 24, 2025
This reverts commit 25000a7.
stormslowly
added a commit
that referenced
this pull request
Jul 24, 2025
SyMind
added a commit
that referenced
this pull request
Jul 24, 2025
2 tasks
SyMind
added a commit
that referenced
this pull request
Jul 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enhance NAPI communication performance through the following optimizations:
In this Next.js benchmark case https://github.com/SyMind/shadcn-ui/tree/next-rspack, build performance improved from 16s to 15s.
Related links
Checklist