Prototype vs instance functions (v10)

Revision 10 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Instance
var myClass = function(){
    this.method = function(x, y){
        return x + y;
    }
};
for(var i = 0; i < 15; i++){
    var instance = new myClass();
    instance.method();
};
ready
Prototype
var myClass = function(){
};

myClass.prototype.method = function(x,y){
    return x + y;
};
for(var i = 0; i < 15; i++){
    var instance = new myClass();
    instance.method();
};
ready

Revisions

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