Commit 7061669d authored by Brian White's avatar Brian White Committed by Ben Noordhuis
Browse files

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: default avatarBen Noordhuis <info@bnoordhuis.nl>
Reviewed-By: default avatarEvan Lucas <evanlucas@me.com>
parent 630f6363
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment