-
-
Notifications
You must be signed in to change notification settings - Fork 588
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: reduce stack mem-move #1739
Conversation
|
!bench |
Benchmark Results
|
@@ -34,7 +34,7 @@ impl Hash for Ast { | |||
impl Ast { | |||
pub fn new(root: SwcStylesheet, source_map: Arc<SourceMap>) -> Self { | |||
Self { | |||
root, | |||
root: box root, |
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.
FYI box keyword / box pattern is perma-unstable rust-lang/rust#49733 (comment)
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 intended to place the item in the box to the heap directly. There are some places that used this, if the syntax changes, I will update this.
How do we measure the cost of stack mem-move? |
@hyf0 Theoretically, for an AST contains huge nodes, it will improve. |
According to perf book
Only struct bigger than 128bytes this perf is meaningful, would you mind double checking the type size of struct? |
@IWANABETHATGUY I missed the fact that almost every huge node downstream are already being boxed, so this results in this optimization being trivial. |
Summary
Test Plan
Related issue (if exists)
How does Webpack handle this? (if exists)
Is this a workaround for the Webpack's implementation?
Further reading