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
Test name
Executions per second
instanceof
5781176.5 Ops/sec
key
12380648.0 Ops/sec
double key
5298325.0 Ops/sec
obj maybe null
9945764.0 Ops/sec
obj typeof "object"
9649779.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"