Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
InstanceOf vs String type
Measure the performance of instanceOf operator vs comparing a basic string type.
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 16_0_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Mobile/15E148 Safari/604.1
Browser:
Mobile Safari 16
Operating system:
iOS 16.0.3
Device Platform:
Mobile
Date tested:
2 years ago
string type
10.0M/s
instanceof
3.9M/s
string type + undefined
3.5M/s
property
3.5M/s
View exact numbers
Test name
Executions per second
✓
string type
9,972,476 Ops/sec
instanceof
3,938,738 Ops/sec
string type + undefined
3,519,422 Ops/sec
property
3,503,875 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;
string type
obj.t === 'mesh'
string type + undefined
obj.t !== undefined
property
obj.a !== undefined