Skip to content

events: don't keep arrays with a single listener

Use the remaining listener directly if the array of listeners has only one element after running EventEmitter.prototype.removeListener().

Advantages:

  • Better memory usage and better performance if no new listeners are added for the same event.

Disadvantages:

  • A new array must be created if new listeners are added for the same event.
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

events

Merge request reports

Loading