Skip to content

events: optimize adding and removing of listeners more

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

Merge request reports

Loading