Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array isArray vs instanceof vs variable.constructor
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Browser:
Chrome 126
Operating system:
Linux
Device Platform:
Desktop
Date tested:
2 years ago
variable.constructor name
8.4M/s
Instanceof
6.0M/s
variable.constructor
6.0M/s
isArray
5.9M/s
View exact numbers
Test name
Executions per second
✓
variable.constructor name
8,362,528 Ops/sec
Instanceof
6,034,226 Ops/sec
variable.constructor
5,993,026 Ops/sec
isArray
5,884,062 Ops/sec
Script Preparation code:
var test = [1,2,3,4]; var c;
Tests:
Instanceof
if (test instanceof Array) { c++; }
isArray
if (Array.isArray(test)) { c++; }
variable.constructor
if (test.constructor === Array) { c++; }
variable.constructor name
if (test.constructor.name === 'Array') { c++; }