-
-
Notifications
You must be signed in to change notification settings - Fork 595
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
perf: improve FlagDependencyExportsPlugin for large JSON by depth #8802
base: main
Are you sure you want to change the base?
perf: improve FlagDependencyExportsPlugin for large JSON by depth #8802
Conversation
✅ Deploy Preview for rspack canceled.Built without sensitive environment variables
|
84ce1e2
to
cad432f
Compare
CodSpeed Performance ReportMerging #8802 will not alter performanceComparing 🎉 Hooray!
|
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.
Generally looks good to me
@@ -13,13 +13,15 @@ pub struct JsonExportsDependency { | |||
id: DependencyId, | |||
#[cacheable(with=AsPreset)] | |||
data: JsonValue, | |||
exports_depth: f64, |
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.
exports_depth: f64, | |
exports_depth: u32, |
u32 should be enough
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.
make sense.
crates/rspack_plugin_json/src/lib.rs
Outdated
@@ -32,7 +32,9 @@ mod utils; | |||
|
|||
#[cacheable] | |||
#[derive(Debug)] | |||
struct JsonParserAndGenerator; | |||
struct JsonParserAndGenerator { | |||
pub exports_depth: f64, |
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.
pub exports_depth: f64, | |
pub exports_depth: u32, |
D( | ||
module.parser[JSON_MODULE_TYPE], | ||
"exportsDepth", | ||
mode === "development" ? 1 : Number.POSITIVE_INFINITY |
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.
mode === "development" ? 1 : Number.POSITIVE_INFINITY | |
mode === "development" ? 1 : Number.MAX_SAFE_INTEGER |
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.
It is Infinity
in webpack. Should we align?
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.
I think both is fine, but I'm not sure what will pass to rust side by napi-rs if we use Infinity here
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.
Make sense. After tested napi locally. I Found that:
js pass Infinity
& rust declare f64
=> exportsDepth: f64::INFINITY(rust side)
js pass Infinity
& rust declare u32
=> exportsDepth: 0
js pass MAX_SAFE_INTEGER
& rust declare f64
=> exportsDepth: 9007199254740991 (2^53-1)
js pass MAX_SAFE_INTEGER
& rust declare u32
=> exportsDepth: 4294967295 (2^32-1)
Should we keep f64
+ Infinity
to align?
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.
Both fine to me, but I prefer u32
a little bit :)
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.
Both fine to me, but I prefer
u32
a little bit :)
No problem. Let we use u32
. I think it's more efficient in rust side.
When there is feedback from users, we can make further changes.
I will update it later.
bb05fe4
to
610aaf0
Compare
Summary
Aligned with webpack/webpack#19058.
I will update doc later.
Checklist