class-perfs (v6)

Revision 6 of this benchmark created on


Preparation HTML

<script src='http://documentcloud.github.com/underscore/underscore.js'></script>
<script src='http://documentcloud.github.com/backbone/backbone-min.js'></script>
<script src='http://static.alipayobjects.com/seajs/1.2.1/sea.js'></script>
<script src='http://aralejs.org/source/arale/class/1.0.0/class.js'></script>
<script>
seajs.use('class/0.9.0/class', function(Class) {
  seajs.Class = Class;
});
</script>
<script src='http://mootools.net/download/get/mootools-core-1.4.5-full-nocompat.js'></script>

Test runner

Ready to run.

Testing in
TestOps/sec
backbone
var Animal = Backbone.Model.extend({
  initialize: function(name) {
    this.name = name;
  },
  talk: function() {
    return 'I am ' + this.name;
  }
});

var Bird = Animal.extend({
  initialize: function(name) {
    Animal.prototype.initialize.call(this, name);
  },
  fly: function() {
    return 'I am flying';
  }
});

new Animal();
var bird = new Bird();
bird.talk();
bird.fly();
ready
mootools
var Animal = new Class({
  initialize: function(name) {
    this.name = name;
  },
  talk: function() {
    return 'I am ' + this.name;
  }
});

var Bird = new Class({
  Extends: Animal,
  initialize: function(name) {
    this.parent(name);
  },
  fly: function() {
    return 'I am flying';
  }
});

new Animal();
var bird = new Bird();
bird.talk();
bird.fly();
ready
arale
var Animal = seajs.Class.create({
  initialize: function(name) {
    this.name = name;
  },
  talk: function() {
    return 'I am ' + this.name;
  }
});

var Bird = Animal.extend({
  initialize: function(name) {
    Bird.superclass.initialize.call(this, name);
  },
  fly: function() {
    return 'I am flying';
  }
});

new Animal();
var bird = new Bird();
bird.talk();
bird.fly();
ready

Revisions

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