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
Test name
Executions per second
instanceof
107312216.0 Ops/sec
key
780677440.0 Ops/sec
double key
809484864.0 Ops/sec
obj maybe null
778825728.0 Ops/sec
obj typeof "object"
771394368.0 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"