revert: perf: napi communication (#11132)#11162
Conversation
This reverts commit 25000a7.
✅ Deploy Preview for rspack canceled.
|
There was a problem hiding this comment.
Pull Request Overview
This PR reverts a previous performance optimization related to NAPI communication between TypeScript and Rust components in the Rspack build system. The revert removes optimizations that were likely causing issues, restoring the previous implementation approach.
Key changes include:
- Revert from direct NAPI object passing to JSON string serialization in normal module factory hooks
- Remove caching optimizations and thread-local storage buffers used for performance
- Restore HashMap usage instead of UkeyMap in core Rust module graph structures
Reviewed Changes
Copilot reviewed 19 out of 21 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/rspack/src/taps/normalModuleFactory.ts | Reverts from direct NAPI object parameter to JSON string parsing for after-resolve data |
| packages/rspack/src/builtin-plugin/ExternalsPlugin.ts | Removes caching optimization and restores inline JSON parsing for resolve requests |
| packages/rspack/etc/core.api.md | Updates API signature to require compiler parameter in ExternalsPlugin raw method |
| crates/rspack_core/src/module_graph/mod.rs | Reverts from UkeyMap back to HashMap for dependency and connection storage |
| crates/rspack_binding_api/src/resource_data.rs | Removes thread-local property buffer optimization for resource data serialization |
| crates/rspack_binding_api/src/raw_options/raw_external.rs | Simplifies external item context structure and removes complex closure context management |
| crates/rspack_binding_api/src/plugins/interceptor.rs | Updates hook registration to use direct NAPI objects instead of JSON strings |
| crates/rspack_binding_api/src/normal_module_factory.rs | Removes serde serialization derives and adds NAPI object attributes |
| crates/rspack_binding_api/src/modules/ | Removes thread-local property buffers across all module types |
| crates/rspack_binding_api/src/module_graph.rs | Removes connection vector buffer and simplifies return types |
| crates/rspack_binding_api/src/compilation/mod.rs | Simplifies module collection without intermediate arrays |
| crates/rspack_binding_api/Cargo.toml | Removes rayon dependency |
Comments suppressed due to low confidence (1)
packages/rspack/src/builtin-plugin/ExternalsPlugin.ts:83
- The variable names 'res' and 'rej' are abbreviated and unclear. Consider using more descriptive names like 'resolve' and 'reject' to match the standard Promise constructor pattern.
return new Promise((res, rej) => {
|
📝 Benchmark detail: Open
|
📦 Binary Size-limit
❌ Size increased by 15.13KB from 49.03MB to 49.05MB (⬆️0.03%) |
CodSpeed Performance ReportMerging #11162 will not alter performanceComparing 🎉 Hooray!
|
Summary
This reverts commit 25000a7.
The commits downgrades some performance.
Related links
Checklist