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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Browser:
Chrome 127
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
variable.constructor name
10.1M/s
variable.constructor
7.2M/s
Instanceof
7.1M/s
isArray
7.1M/s
View exact numbers
Test name
Executions per second
✓
variable.constructor name
10,139,107 Ops/sec
variable.constructor
7,150,488 Ops/sec
Instanceof
7,110,172 Ops/sec
isArray
7,055,670 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++; }