Skip to content

process: small nextTick cleanup, including removing manual args copying

A couple of small changes to nextTick, mostly dependant on V8 6.4+ so we shouldn't back-port these.

  1. Instead of manually copying the arguments into a new Array, use rest syntax to gather up the arguments as it's actually more performant starting with V8 6.4.

  2. As of V8 6.4 it appears to no longer be necessary to preset the callback on TickObject to null to avoid hidden class function tracking. The benchmark perf is now equivalent regardless. (Edit: this doesn't seem to apply universally so it's possible the reasoning here is different. In Timers, I'm still unable to get rid of similar code without tanking the performance 3x. Strangely we have a similar benchmark for both timers & nextTick but clearly something else is going on...)

  3. This is a temporary commit that introduces the 1st change to internalNextTick but will be made redundant once #19147 lands.

There's a performance benefit to this change on most of our nextTick benchmarks except for two but the regression there is smaller than the overall gains. It also slightly improves some of the streams benchmarks which should be more representative of real usage. Edit: see below for more info.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Merge request reports

Loading