instanceof performance

Benchmark created on


Setup

function Test()
    {
    this.property = true;
    }
    
    var arr = [];
    var result;
    for(var i = 0; i < 1000; i++)
    arr.push(new Test());

Test runner

Ready to run.

Testing in
TestOps/sec
instanceof
for(var i = 0; i < 1000; ++i)
{
var t = arr[i];
result = t instanceof Test;
}
ready
property
for(var i = 0; i < 1000; ++i)
{
var t = arr[i];
result = t.property;
}
ready

Revisions

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