lib: micro-optimize EventEmitter#removeListener()
authorBen Noordhuis <info@bnoordhuis.nl>
Fri, 19 Dec 2014 23:04:35 +0000 (00:04 +0100)
committerBen Noordhuis <info@bnoordhuis.nl>
Sat, 20 Dec 2014 01:39:42 +0000 (02:39 +0100)
commitd3f8db124463e478420d8bba6fa5cf13af7b4ecb
tree70d67ca22134ce144bba0e3d591f79020b9e5f01
parentd0c238cc81a7bc4d67453ae2952d7d9368069f89
lib: micro-optimize EventEmitter#removeListener()

Replace the call to Array#splice() with a faster open-coded version
that creates less garbage.

Add a new benchmark to prove it.  With the change applied, it scores
a whopping 40% higher.

PR-URL: https://github.com/iojs/io.js/pull/185
Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com>
benchmark/events/ee-add-remove.js [new file with mode: 0644]
lib/events.js