diff options
author | Brian White <mscdex@mscdex.net> | 2015-02-12 01:00:12 +0300 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2015-02-12 01:06:26 +0300 |
commit | 7061669dba26337e47e258385dd58e400881dff1 (patch) | |
tree | f6e4032f2c52c3ee2b30c32f22e6f07b5b9650a8 /src/util-inl.h | |
parent | 630f63633490f60a292e62bb7a82bd9ea4de68c4 (diff) |
events: optimize adding and removing of listeners
These optimizations result in >2x speedup in the ee-add-remove
benchmark:
* Don't mutate array.length when removing the last listener for
an event
* Don't bother checking max listeners if listeners isn't an array
* Don't call delete when removing the last event in _events, just
re-assign a new object instead
PR-URL: https://github.com/iojs/io.js/pull/785
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Diffstat (limited to 'src/util-inl.h')
0 files changed, 0 insertions, 0 deletions