tildeio/rsvp.js — pull request #117 by lukemelia (2013-09-22 05:11:06+00:00)
Title: Performance improvements via simplifying and optimizing event emitter

This includes:

* Removed support for multiple eventnames from `on` and `off`.
* Removed defensive code around duplicate event registrations.
* Removing an event removes all handlers for that event name --
there is no longer a way to remove a specific event handler.
* Optimized object shape for the event target mixin.

These changes are all in the service of performance. We used
a slightly modified version of cujojs/promise-perf-tests to
benchmark, which runs in node. We've attached them below.

@stefanpenner / @lukemelia

~
````
> promise-perf-tests@0.3.2 test /Users/lmelia/p/promise-perf-tests
> ./bin/run.sh

==========================================================
Test: promise-fulfill x 10000
----------------------------------------------------------
Name Time ms Avg ms Diff %
when 26 0.0026 -
q 43 0.0043 65.38
rsvp PR 90 0.0090 246.15
rsvp master 94 0.0094 261.54

==========================================================
Test: promise-reject x 10000
----------------------------------------------------------
Name Time ms Avg ms Diff %
q 38 0.0038 -
when 48 0.0048 26.32
rsvp PR 66 0.0066 73.68
rsvp master 100 0.0100 163.16

==========================================================
Test: promise-sequence x 10000
----------------------------------------------------------
Name Time ms Avg ms Diff %
when 82 0.0082 -
q 191 0.0191 132.93
rsvp PR 240 0.0240 192.68
rsvp master 411 0.0411 401.22

==========================================================
Test: defer-create x 100000
----------------------------------------------------------
Name Time ms Avg ms Diff %
rsvp PR 76 0.0008 -
when 208 0.0021 173.68
q 243 0.0024 219.74
rsvp master 276 0.0028 263.16

==========================================================
Test: defer-fulfill x 10000
----------------------------------------------------------
Name Time ms Avg ms Diff %
when 85 0.0085 -
rsvp PR 120 0.0120 41.18
rsvp master 206 0.0206 142.35
q 247 0.0247 190.59

==========================================================
Test: defer-reject x 10000
----------------------------------------------------------
Name Time ms Avg ms Diff %
when 80 0.0080 -
rsvp PR 131 0.0131 63.75
rsvp master 203 0.0203 153.75
q 228 0.0228 185.00

==========================================================
Test: defer-sequence x 10000
----------------------------------------------------------
Name Time ms Avg ms Diff %
when 127 0.0127 -
rsvp PR 214 0.0214 68.50
q 291 0.0291 129.13
rsvp master 433 0.0433 240.94
````