instanceof performance (v14)

Revision 14 of this benchmark created by evilive on


Setup

function Test() {
      this.clazz = "Test";
    }
    
    function Test2() {
      this.clazz = "Test2";
    }
    
    function Test3() {
      this.clazz = "Test3";
    }
    
    Test2.prototype = new Test();
    Test3.prototype = new Test2();
    
    var ts = new Test();
    var ts2 = new Test2();
    var ts3 = new Test3();

Test runner

Ready to run.

Testing in
TestOps/sec
instanceof 1
ts instanceof Test;
ready
instanceof 2
ts2 instanceof Test2;
ready
opti worst
ts.clazz == "Test3" || ts instanceof Test3;
ready
opti 0
ts3.clazz == "Test2" || ts3 instanceof Test2;
ready
opti success
ts3.clazz == "Test3" || ts3 instanceof Test3;
ready

Revisions

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