-
-
Notifications
You must be signed in to change notification settings - Fork 787
perf(browser): minor performance optimization for @rspack/browser #11795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for rspack ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this 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 introduces minor performance optimizations for @rspack/browser by reducing unnecessary operations and reorganizing initialization code.
- Disables
TraceHookPlugin
in browser environments to avoid unnecessary overhead - Introduces
BufferOrBytes
enum to prevent data cloning fromBuffer
toVec<u8>
in HTTP operations - Moves tokio runtime initialization from
.init_array
section tomodule_exports
for better timing control
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
packages/rspack/src/Compiler.ts | Conditionally disables TraceHookPlugin for browser builds |
crates/rspack_plugin_schemes/src/http_uri/http_cache.rs | Introduces BufferOrBytes enum and optimizes HTTP response handling |
crates/rspack_plugin_schemes/Cargo.toml | Adds napi dependency for Buffer support |
crates/rspack_binding_api/src/raw_options/raw_builtins/raw_http_uri.rs | Updates HttpResponse to use Buffer directly |
crates/rspack_binding_api/src/lib.rs | Moves tokio runtime initialization from .init_array to module_exports |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
📦 Binary Size-limit
❌ Size increased by 8.00KB from 47.89MB to 47.89MB (⬆️0.02%) |
CodSpeed Performance ReportMerging #11795 will not alter performanceComparing Summary
|
Summary
This pr introduces some minor performance optimization for @rspack/browser:
TraceHookPlugin
in browser.BufferOrBytes
to avoid unnecessary data clone fromBuffer
toVec<u8>
inHttpUriPlugin
..init_array
section to napimodule_exports
. It doesn't improve the performance for now, but it makes it possible to initialize javascript worker pool ahead of time in the future. Currently code in.init_array
section is executed too early before the emnapi worker pool is prepared.Checklist