Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Commit 7ce5a31

Browse files
tricknotesbnoordhuis
authored andcommitted
events: define properties on prototype
Speeds up EventEmitter object construction by about 15-20%.
1 parent 6af8788 commit 7ce5a31

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/events.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ function EventEmitter() {
3737
}
3838
exports.EventEmitter = EventEmitter;
3939

40+
EventEmitter.prototype.domain = undefined;
41+
EventEmitter.prototype._events = undefined;
42+
EventEmitter.prototype._maxListeners = undefined;
4043

4144
// By default EventEmitters will print a warning if more than 10 listeners are
4245
// added to it. This is a useful default which helps finding memory leaks.

0 commit comments

Comments
 (0)