-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
util: improve performance of function areSimilarFloatArrays #51040
Conversation
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.
LGTM
@nodejs/v8 can you please have a look at this? It seems rather odd that the performance difference exists here.
Nit: @Septa2112 could you please update the commit message body's to include the "PR-URL"? That way the linter won't complain anymore 😃 |
Thanks for your suggestion. But according to my understanding, the "PR-URL" will only be generated when my commit is merged into the main branch. And I just referred to this PR #50621. Maybe the "Refs" should not be changed to "PR-URL"? So is it better to delete this |
|
Sorry, I meant to add that part. I misread the number and it can be added later on. |
Improve performance of areSimilarFloatArrays by using primordial. Refs: nodejs#50621
Landed in 1045f28 |
Improve performance of areSimilarFloatArrays by using primordial. Refs: #50621 PR-URL: #51040 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]> Reviewed-By: James M Snell <[email protected]>
Improve performance of areSimilarFloatArrays by using primordial. Refs: #50621 PR-URL: #51040 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]> Reviewed-By: James M Snell <[email protected]>
Improve performance of
areSimilarFloatArrays
by using primordial.How find the issue
When I test performance between node-16.x and node-22-pre, I found performance regression in
benchmark/assert/deepequal-typedarrays.js
. Old binary isnode-16.x
and the new isnode-22-pre
Original result of node-16.x and node-22-pre
How solved
I found the case
benchmark/assert/deepequal-typedarrays.js
will finally call functionareSimilarFloatArrays(a, b)
inlib/internal/util
whenstrict=0 type='Float32Array'
. The problem is similar with #50620. So I learned from the approach in #50621.Results
Comparison between node_16.x and node-22-pre
I modified the code in main branch (v22.0.0-pre), and compare with node_16.x
Performance improvement on main(node-22-pre)
After the change, test on the latest main branch and get the results of performance comparison of node_22 before and after modifying the code.
Refs: #50621