exoskeleton vs backbone events (v22)

Revision 22 of this benchmark created on


Preparation HTML

<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.1/lodash.js'></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.2.3/backbone-min.js'></script>
<script>var bbEvents = Backbone.Events;</script>
<script>var extend = _.extend; window._ = null;</script>
<script src="https://raw.githubusercontent.com/paulmillr/exoskeleton/master/exoskeleton.js"></script>
<script>var exosEvents = Backbone.Events;</script>

Setup

var numEvents = 3;
    var numListeners = 100;
    var bb = extend({
      x: 0
    }, bbEvents);
    var exos = extend({
      x: 0
    }, exosEvents);
    //while(bb.x < 100) {
    [bb, exos].forEach(function(obj) {
      obj.on('event'+obj.x, function() {
        obj.x++;
      });
      obj.on('event'+obj.x, function() {
        obj.x++;
      });
      obj.off();
    });
    //}

Test runner

Ready to run.

Testing in
TestOps/sec
Exoskeleton
for (var i = 0; i < 100; i++) exos.trigger('event' + i, 1, 2, 3);
ready
Backbone
for (var i = 0; i < 100; i++) bb.trigger('event' + i, 1, 2, 3);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.