Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array checking: isArray vs val.with
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/131.0.0.0 Safari/537.36
Browser:
Chrome 131
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Prop check on array
5.0M/s
Prop check on string
4.9M/s
isArray on string
4.9M/s
isArray on array
4.8M/s
View exact numbers
Test name
Executions per second
✓
Prop check on array
5,033,140 Ops/sec
Prop check on string
4,943,018 Ops/sec
isArray on string
4,884,690 Ops/sec
isArray on array
4,827,220 Ops/sec
Script Preparation code:
var array = [1,2,3,4]; var string = '[1,2,3,4]'; var c;
Tests:
Prop check on array
if (array.with) { c++; } else { c++; }
isArray on array
if (Array.isArray(array)) { c++; } else { c++; }
Prop check on string
if (string.with) { c++; } else { c++; }
isArray on string
if (Array.isArray(string)) { c++; } else { c++; }