Skip to content

Commit

Permalink
events: define properties on prototype
Browse files Browse the repository at this point in the history
Speeds up EventEmitter object construction by about 15-20%.
  • Loading branch information
tricknotes authored and bnoordhuis committed May 30, 2013
1 parent 6af8788 commit 7ce5a31
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/events.js
Expand Up @@ -37,6 +37,9 @@ function EventEmitter() {
}
exports.EventEmitter = EventEmitter;

EventEmitter.prototype.domain = undefined;
EventEmitter.prototype._events = undefined;
EventEmitter.prototype._maxListeners = undefined;

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

0 comments on commit 7ce5a31

Please sign in to comment.