events: fix unwrapping of ee.once() listeners
Pull Request check-list
Please make sure to review and check all of these items:
-
Does make -j8 test
(UNIX) orvcbuild test nosign
(Windows) pass with this change (including linting)? -
Is the commit message formatted according to CONTRIBUTING.md? -
If this change fixes a bug (or a performance problem), is a regression test (or a benchmark) included? -
Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.
Affected core subsystem(s)
- events
Description of change
The wrapped listeners from once()
weren't handled consistently. This PR fixes up the two additional places that they are exposed publicly ('removeListener'
and listeners()
). There is a slowdown in doing so, but not too bad.
Unsure if a documentation update would be necessary (to say "it used to behave like so").
make bench-events:
make -C out BUILDTYPE=Release V=1
make[1]: Entering directory '/home/omsmith/dev/node/out'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/omsmith/dev/node/out'
ln -fs out/Release/node node
events/ee-add-remove.js
events/ee-add-remove.js n=250000: 1603452.07582
events/ee-emit-multi-args.js
events/ee-emit-multi-args.js n=2000000: 8104495.63870
events/ee-emit.js
events/ee-emit.js n=2000000: 11585336.72431
events/ee-listener-count-on-prototype.js
events/ee-listener-count-on-prototype.js n=50000000: 627837401.26347
events/ee-listeners-many.js
events/ee-listeners-many.js n=5000000: 4315208.71881
events/ee-listeners.js
events/ee-listeners.js n=5000000: 26674496.30709
(master):
make -C out BUILDTYPE=Release V=1
make[1]: Entering directory '/home/omsmith/dev/node/out'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/omsmith/dev/node/out'
ln -fs out/Release/node node
events/ee-add-remove.js
events/ee-add-remove.js n=250000: 1721243.70130
events/ee-emit-multi-args.js
events/ee-emit-multi-args.js n=2000000: 8197063.10213
events/ee-emit.js
events/ee-emit.js n=2000000: 11848856.46094
events/ee-listener-count-on-prototype.js
events/ee-listener-count-on-prototype.js n=50000000: 617810355.54937
events/ee-listeners-many.js
events/ee-listeners-many.js n=5000000: 4734838.53093
events/ee-listeners.js
events/ee-listeners.js n=5000000: 28938418.31657