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; rv:124.0) Gecko/20100101 Firefox/124.0
Browser:
Firefox 124
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
double key
809.5M/s
key
780.7M/s
obj maybe null
778.8M/s
obj typeof "object"
771.4M/s
instanceof
107.3M/s
View exact numbers
Test name
Executions per second
✓
double key
809,484,864 Ops/sec
key
780,677,440 Ops/sec
obj maybe null
778,825,728 Ops/sec
obj typeof "object"
771,394,368 Ops/sec
instanceof
107,312,216 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"