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/0.9.2/backbone.js'></script>
<script>var oldEvents = Backbone.Events;</script>
<script src='https://raw.github.com/documentcloud/backbone/0.5.3/backbone.js'></script>
<script>var olderEvents = Backbone.Events;</script>
<script src='https://raw.github.com/documentcloud/backbone/master/backbone.js'></script>
<script>var masterEvents = Backbone.Events;</script>
<script>
Benchmark.prototype.setup = function() {
var old = _.extend({}, oldEvents);
var older = _.extend({}, olderEvents);
var master = _.extend({}, masterEvents);
var numEvents = 3;
var numListeners = 100;
_.times(numEvents, function(event) {
_.times(numListeners, function() {
old.on("event" + event, function(){});
older.on("event" + event, function(){});
master.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 | |
|---|---|---|
0.5.3 |
|
pending… |
0.9.2 |
|
pending… |
master |
|
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