src: cut small costs in node::MakeCallback - #66395
nigrosimone wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #66395 +/- ##
==========================================
+ Coverage 90.35% 90.38% +0.03%
==========================================
Files 792 792
Lines 275500 275592 +92
Branches 52791 52848 +57
==========================================
+ Hits 248932 249105 +173
+ Misses 16992 16893 -99
- Partials 9576 9594 +18
🚀 New features to boost your workflow:
|
|
Benchmark GHA (napi / make_callback): https://github.com/nodejs/node/actions/runs/36693603945 Results
Benchmark results:
|
Enter the Environment's context only when it is not already the entered and current one, set the async context frame only when it changes, pass the resource variant to push_async_context() by const reference, and grow and shrink the native resource stack with push_back() and pop_back() instead of resize(). Refs: nodejs/performance#24 Signed-off-by: Nigro Simone <nigro.simone@gmail.com>
4667f95 to
8acef08
Compare
@addaleax The GHA benchmark could not load the binding ("Binding failed to load" in every job): the workflow runs make build-ci but never make bench-addons-build, so no napi/* benchmark can run there. The table in the description is benchmark/compare.js on my machine. |
The GHA benchmark never built the addons of benchmark/napi, and its --debug-node build made benchmark/common.js look for them in build/Debug. Build them when the napi category runs, and pick the build type as test/common does. Refs: nodejs#66395 Signed-off-by: Nigro Simone <nigro.simone@gmail.com>
After #66316, node::MakeCallback still does some work that the common case does not need:
async_context_frame::exchange()skips the set, for every callerEach one is 1-5 ns, together about 14-16 ns per call. type=Call does not use this code. benchmark/compare.js, 30 runs, Linux x64:
Refs: nodejs/performance#24
Disclosure: I used Opus 5.5 (Max) as coding assistant