Moo-Resig-Ender-My-JS.CLASS

JavaScript performance comparison

Revision 24 of this test case created by Mark Johnson

Info

Comparing Mootools, John Resig, Ender & My.js class systems on calling a method that calls a super method. Check the scripts MooTest.js, JRTest.js, EnderTest.js, MyTest.js, JSFace and JS.CLASS

Preparation code

<script src="http://myjs.fr/my-class/example/MooClass.js"></script>
<script src="http://myjs.fr/my-class/example/JRClass.js"></script>
<script src="http://myjs.fr/my-class/example/EnderClass.js"></script>
<script src="http://myjs.fr/my-class/my.class.min.js"></script>
<script src="http://myjs.fr/my-class/example/MooTest.js"></script>
<script src="http://myjs.fr/my-class/example/JRTest.js"></script>
<script src="http://myjs.fr/my-class/example/EnderTest.js"></script>
<script src="http://myjs.fr/my-class/example/MyTest.js"></script>
<script src="//dl.dropbox.com/u/7677927/jsface.js"></script>
<script src="http://dl.dropbox.com/u/4382143/jsclass-test/jsfaceperson.js"</script>
<script src="//dl.dropbox.com/u/7677927/jsface.js"></script>
<script src="http://dl.dropbox.com/u/4382143/jsclass-test/core.js"></script>
<script src="http://dl.dropbox.com/u/4382143/jsclass-test/jsclasstest.js"></script>
<script src="http://dl.dropbox.com/u/7677927/oop-benchmark/lib/ptclass.js"></script>

<script>
var PTClassPerson = PTClass.create({
  initialize: function(name){
    this.name = name;
  },
  setAddress: function(country, city, street) {
    this.country = country;
    this.city = city;
    this.street = street;
  }
});

var PTClassFrenchGuy = PTClass.create(PTClassPerson, {
  initialize: function($super, name) {
    $super(name);
  },
  setAddress: function($super, city, street) {
    $super('France', city, street);
  }
});

var PTClassParisLover = PTClass.create(PTClassFrenchGuy, {
  initialize: function($super, name) {
    $super(name);
  },
  setAddress: function($super, street) {
    $super('Paris', street);
  }
});
</script>

<script>
  var mooJohn = new MooParisLover('Carla Bruni');
  var jrJohn = new JRParisLover('Carla Bruni');
  var enderJohn = new EnderParisLover('Carla Bruni');
  var myJohn = new MyParisLover('Carla Bruni');
  var jsfaceJohn = new JSFaceParisLover('Carla Bruni');
  var jsClassJohn = new JSClassParisLover('Carla Bruni');
  var ptClassJohn = new PTClassParisLover('Carla Bruni');
</script>

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Moo
mooJohn.setAddress('Matignon');
pending…
John Resig
jrJohn.setAddress('Matignon');
pending…
Ender
enderJohn.setAddress('Matignon');
pending…
My.js
myJohn.setAddress('Matignon');
pending…
JSFace.js
jsfaceJohn.setAddress('Matignon');
pending…
JS.Class
jsClassJohn.setAddress('Matignon');
pending…
PT
ptClassJohn.setAddress('Matignon');
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:

0 comments

Add a comment