async_hooks: add currentResource
Remove the need for the destroy hook in the basic APM case. APM and continuation local storage users can use only the init hook.
This lead to a 5% improvement in throughput. in the attached benchmark:
async_hooks/current-resource-vs-destroy.js n=1000000 method="callbacks" type="current-resource" benchmarker="wrk": 7,428.04
async_hooks/current-resource-vs-destroy.js n=1000000 method="async" type="current-resource" benchmarker="wrk": 5,938.27
async_hooks/current-resource-vs-destroy.js n=1000000 method="callbacks" type="destroy" benchmarker="wrk": 7,142.18
async_hooks/current-resource-vs-destroy.js n=1000000 method="async" type="destroy" benchmarker="wrk": 5,297.4
I've also measured this against a simple Hapi v17 server and it leads to a 15% improvement.
cc @nodejs/diagnostics @bmeurer @MayaLekova
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines