class-perfs (v5)

Revision 5 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='https://github.com/seajs/seajs/blob/master/dist/sea.js'>
</script>
<script src='http://aralejs.org/dist/class/0.9.0/class.js'>
</script>
<script src="http://www.fortale.com/open/scripts/min/archetype.all.obsc.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
Archetype
Bootkit.define("Animal", {
  Animal: function(name) {
    this.name = name;
  },
  talk: function() {
    return 'I am ' + this.name;
  }
});

Bootkit.define("Bird", {
  extend: Animal,
  Animal: function(name) {
    this.name = 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.