EventEmitter: use a Map to store event listeners
This is a fix for #728 (closed).
I ran the events benchmarks to compare this with master and there seems to be a significant performance drop for some cases (though I'm not sure of how I should compare the runs).
Bench | master | Map |
---|---|---|
ee-add-remove | 1216157 | 950515 (-22%) |
ee-emit-multi-args | 5909434 | 5640342 (-5%) |
ee-emit | 8485253 | 7912000 (-7%) |
ee-listener-count | 432010872 | 56945905 (-87%) |
ee-listeners-many | 3558539 | 3490269 (-2%) |
ee-listeners | 21596479 | 18429471 (-15%) |