Skip to content

Commit

Permalink
Add further performance details
Browse files Browse the repository at this point in the history
  • Loading branch information
danielstjules committed Feb 25, 2014
1 parent e7c705d commit 9900d95
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ that this covers a great majority of event use.

Despite the ease of replacing EventEmitter throughout your application, I
wouldn't recommend it. There is a performance hit that must be taken into
consideration. Due to PatternEmitter piggy backing off of EventEmitter's methods
and private properties, it is much slower. This was done in an attempt to
prevent copying a majority of the source in `node/lib/events.js`. However, a
rewrite may be done to reduce this performance gap.
consideration for any event-heavy code. Due to PatternEmitter piggy backing off
of EventEmitter's methods and private properties, it is slower. This was done
in an attempt to prevent copying a majority of the source in
`node/lib/events.js`. However, a rewrite may be done to reduce this performance
gap.

To illustrate, consider the performance difference between both modules when
only registering to string events, no patterns:
Expand All @@ -98,7 +99,8 @@ PatternEmitter x 92,760 ops/sec ±1.08% (93 runs sampled)
```

Each operation in the above benchmark is invoking 100 listeners: 10 for each
of 10 different events.
of 10 different events. That is, 18,428,600 vs 9,276,000 invocations a second
on my Macbook Air.

## Class: PatternEmitter

Expand Down

0 comments on commit 9900d95

Please sign in to comment.