Skip to content

events: remove emit micro-optimizations

With improvements in V8, using separate emit functions is no longer necessary. This is not applicable to v8.x or earlier (the earlier version that's baking is though).

improvement                             confidence        p.value
events/ee-emit.js n=2000000                 2.98 %        0.09852489
events/ee-emit-2-args.js n=2000000          4.19 %    *** 0.0001914216
events/ee-emit-6-args.js n=2000000         61.69 %    *** 6.611964e-35
events/ee-emit-diff-args.js n=2000000      -0.36 %        0.305069
events/ee-once.js n=20000000                6.42 %    *** 1.27831e-06

ee-emit-diff-args.js was a custom benchmark to confirm whether there was any deoptimization happening when the function pattern — number of arguments passed in — would change unpredictably (between 0 - 3 arguments, so what used to be the fast path). I also had a version of that benchmark with 0-4 arguments and that one was +20% or so, due to the improvements in emit performance for more than 3 arguments.

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

benchmark, events

Merge request reports

Loading