Prototype vs. this (v3)

Revision 3 of this benchmark created by Mr X on


Setup

function T1() {}
    
    T1.prototype.myMethod = function() {};
    
    function T2() {
      this.myMethod = function() {};
    }
    
    var t1 = new T1;
    var t2 = new T2;

Test runner

Ready to run.

Testing in
TestOps/sec
Using prototype
t1.myMethod();
ready
Using this
t2.myMethod();
ready

Revisions

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