events: optimize listener array cloning
authorBrian White <mscdex@mscdex.net>
Thu, 5 Mar 2015 03:21:47 +0000 (22:21 -0500)
committerBrian White <mscdex@mscdex.net>
Thu, 5 Mar 2015 03:21:47 +0000 (22:21 -0500)
commit555a7c48cf3b038f9627591cf51b68387f8de36a
tree66bc2a039b0e4ab5c3ec9b37ee053eb31ac6c28e
parent563771d8b1c21cd6bb08630e21e94b4f86253daa
events: optimize listener array cloning

This both switches to a single algorithm for array cloning and also
speeds up (by ~100% in the ee-listeners-many benchmark) the
"many elements"  case that was previously handled by
`array.slice()`.

PR-URL: https://github.com/iojs/io.js/pull/1050
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Julian Duque <julianduquej@gmail.com>
lib/events.js