timers: allow Immediates to be unrefed
Slightly refactor the Immediates handling to allow for them to be unrefed, similar to setTimeout, but without extra handles. Adds immediate.ref()
and immediate.unref()
.
There's a roughly 5-10% performance regression on some of the immediate benchmarks, as well as a more substantial regression on clearImmediate
. Both are a result of needing to track an extra property on the Immediate class. That said, since 9.0.0 got released we've seen the performance on setImmediate
benchmarks grow by roughly 40-50%, so IMO we can afford this slight regression.
CI: https://ci.nodejs.org/job/node-test-pull-request/12523/ Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/96/ CitGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/1202/
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
Affected core subsystem(s)
timers