JS and OOP (v3)

Revision 3 of this benchmark created by devu on


Test runner

Ready to run.

Testing in
TestOps/sec
Closure
(function() {
  exe = function() {
    console.log("executed");
  }
  exe();
})();
ready
Class priv autoexec
function Object() {
  var exe = function() {
      console.log("executed");
      }
      
  exe();
}
var obj = new Object();
ready
Class priv
ObjectB = function() {
  this.exe = function() {
    console.log("executed");
  }
}
var obj = new ObjectB();
obj.exe();
ready
Class proto ref
exe = function() {
  console.log("executed");
}

ObjectC = function() {}
ObjectC.prototype.exe = exe;
var obj = new ObjectC();
obj.exe();
ready
Literal
var object = {
  exe: function exe() {
    console.log("executed");
  }
}

object.exe();
ready

Revisions

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