-
-
Notifications
You must be signed in to change notification settings - Fork 503
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(transformer/arrow-function): store scope_id to avoid going through scopes #7041
Conversation
Your org has enabled the Graphite merge queue for merging into mainAdd the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
aae39c9
to
3aacc67
Compare
21bc884
to
47e0e3a
Compare
CodSpeed Performance ReportMerging #7041 will not alter performanceComparing Summary
|
aa47e5d
to
1674cf5
Compare
this
I've broken out the change to using |
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'm not sure if this is a good idea or not. It makes entering/exiting functions more expensive, in order to make resolving this
bindings cheaper.
ThisVar
is 24 bytes, and it creates one for every function. Whereas previously SparseStack
only took 1 byte (a bool
) for each function (except for functions which need _this
inserted into them, which take a further 24 bytes).
On the positive side, you avoid having to search up the tree to find the scope of the parent function when you do find a this
within an arrow function. Note: That search only happens on 1st this
within that parent function.
So whether this change is a perf improvement or not depends on which is more common: functions, or this
within arrow functions (in particular, a single this
). The answer will depend on the nature of the code being transformed.
On our benchmarks, it appears to be mostly negative (-0.1% to -0.3%) and it's hard to see if it's positive or negative on RadixUIAdoptionSection.jsx
benchmark, as that one is so noisy. But either way, it doesn't make much difference.
If you want to merge this, I don't object. If you want to close it, I don't object either!
One last thing: If you do close it, please don't see it as wasted time. Often the only way to find out if something improves perf or not is to try, and often the result is unexpected - things you think will have marginal impact can surprisingly win you 5%, and other things you had high hopes for do nothing. So we need to experiment.
Thanks for taking your precious time on this! Yes, we can't determine which way now, I will leave it until I move the implementation of |
d2b9343
to
fe6818b
Compare
1674cf5
to
ab06cc1
Compare
ab06cc1
to
d320f62
Compare
Closing as we don't see a noticeable performance improvement |
Not sure if this will boost performance, so create a PR to see the benchmark