Events vs Events2
JavaScript performance comparison
Preparation code
<script src='https://raw.github.com/documentcloud/underscore/master/underscore.js'></script>
<script src='https://raw.github.com/documentcloud/backbone/df74b030e96cbf0ff7dc19160105ba1aed3e6751/backbone.js'></script>
<script>var masterEvents = Backbone.Events;</script>
<script src='https://raw.github.com/paulmillr/backbone/events/backbone.js'></script>
<script>var caseyEvents = Backbone.Events;</script>
<script>
Benchmark.prototype.setup = function() {
master = _.extend({}, masterEvents);
casey = _.extend({}, caseyEvents);
numEvents = 3;
numListeners = 100;
_.times(numEvents, function(event) {
_.times(numListeners, function() {
master.on("event" + event, function(){});
casey.on("event" + event, function(){});
});
});
};
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
master |
|
pending… |
casey |
|
pending… |
Compare results of other browsers
Revisions
You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:
- Revision 1: published
- Revision 2: published by Jeremy Ashkenas
- Revision 3: published by Jeremy Ashkenas
- Revision 4: published by Jeremy Ashkenas
- Revision 5: published
- Revision 6: published
- Revision 7: published
- Revision 8: published by Jeremy Ashkenas
- Revision 9: published
- Revision 10: published by Romain Beauxis
- Revision 12: published
- Revision 14: published
- Revision 15: published
- Revision 16: published by Tim Griesser
- Revision 17: published
- Revision 19: published
- Revision 20: published
- Revision 21: published
- Revision 22: published
- Revision 23: published
- Revision 24: published
- Revision 33: published and last updated
- Revision 34: published and last updated
- Revision 35: published by stefan and last updated
- Revision 36: published by stefan and last updated
- Revision 38: published by stefan
0 comments