module-vs-proto

JavaScript performance comparison

Test case created by Stew

Preparation code

<script>
ModuleTest = (function() {
  _x = 0;
  _inc = function() {
    _x++;
  }
  return {
    inc: _inc,
    x: function(){return _x;}
  }
})();

var ProtoTest = function() {
  this.x = 0;
}

ProtoTest.prototype.inc = function() {
  this.x++;
}

var ProtoSingleton = new ProtoTest();
</script>
    

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
Module
ModuleTest.inc();
pending…
Prototype
ProtoSingleton.inc();
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