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>
parent
630f6363
Please register or sign in to comment