exoskeleton vs backbone events

JavaScript performance comparison

Test case created by Paul Miller

Preparation code

<script src='//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.2.0/lodash.underscore.js'></script>
<script src='//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.0/backbone-min.js'></script>
<script>var bbEvents = Backbone.Events;</script>
<script>var extend = _.extend; window._ = null;</script>
<script src="https://github.com/paulmillr/exoskeleton/releases/download/0.5.1/exoskeleton.js"></script>
<script>var exosEvents = Exoskeleton.Events;</script>
      
<script>
Benchmark.prototype.setup = function() {
  var numEvents = 3;
  var numListeners = 100;
  var bb = extend({x:0}, bbEvents);
  var exos = extend({x:0}, exosEvents);
  
  [bb, exos].forEach(function(obj) {
    obj.on('event1', function() { obj.x++; });
    obj.on('event2', function() { obj.x++; });
    obj.off();
  });

};
</script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Exoskeleton
for (var i = 0; i < 100; i++) exos.trigger('event' + i, 1, 2, 3);
pending…
Backbone
for (var i = 0; i < 100; i++) bb.trigger('event' + i, 1, 2, 3);
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.

0 Comments