Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
InstanceOf vs key in obj vs !== null vs string in key
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36
Browser:
Chrome 123
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
key
12.4M/s
obj maybe null
9.9M/s
obj typeof "object"
9.6M/s
instanceof
5.8M/s
double key
5.3M/s
View exact numbers
Test name
Executions per second
✓
key
12,380,648 Ops/sec
obj maybe null
9,945,764 Ops/sec
obj typeof "object"
9,649,779 Ops/sec
instanceof
5,781,176 Ops/sec
double key
5,298,325 Ops/sec
HTML Preparation code:
<script> class TestClass { constructor() { this.a = 2; this.t = 'mesh'; } } </script>
Script Preparation code:
var obj = new TestClass();
Tests:
instanceof
obj instanceof TestClass;
key
"t" in obj
double key
(obj.t === "other" || obj.t === "mesh")
obj maybe null
obj !== null
obj typeof "object"
typeof obj === "object"