-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
src,lib: optimize nodeTiming.uvMetricsInfo #55614
Conversation
RafaelGSS
commented
Oct 31, 2024
Review requested:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #55614 +/- ##
==========================================
+ Coverage 88.43% 88.45% +0.01%
==========================================
Files 654 654
Lines 187662 187751 +89
Branches 36117 36149 +32
==========================================
+ Hits 165962 166066 +104
+ Misses 14938 14937 -1
+ Partials 6762 6748 -14
|
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
Why is this PR faster? You create an array from C++, return it to JavaScript, then you convert the array into an object. Previously, it just returned an object. What is the catch? |
@lemire The simple answer is: creating an object and transferring from C++ to is costly. Instead of returning just arraysize of 3 uint64_t an object requires allocation of each field value (for instance, In my experience, anything that is sent from C++ to JS (and vice versa) is costly and when you reduce the object size you very often get a performance gain. |
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.
Just change the initial commit message, I think is not reflecting the current changes.
5cd80e7
to
4df0ff2
Compare
This makes sense, but isn't there a design issue in the first place in the fact that a performance sensitive function (in JavaScript) returns an object? |
PR-URL: #55614 Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Stephen Belanger <[email protected]> Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
PR-URL: #55614 Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Stephen Belanger <[email protected]> Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
Landed in 9b6cea6...d83e9fa |
Maybe... but I believe this falls more on the V8 side than the Node.js one. I haven't investigated that communication closely so I might not be able to answer it with precision. |
PR-URL: #55614 Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Stephen Belanger <[email protected]> Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
PR-URL: #55614 Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Stephen Belanger <[email protected]> Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
PR-URL: nodejs#55614 Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Stephen Belanger <[email protected]> Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
PR-URL: nodejs#55614 Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Stephen Belanger <[email protected]> Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
PR-URL: nodejs#55614 Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Stephen Belanger <[email protected]> Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
PR-URL: nodejs#55614 Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Stephen Belanger <[email protected]> Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>