Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
underscore isString VS typeof
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Browser:
Chrome 120
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
underscore check 1
1767732.5 Ops/sec
underscore check 2
3289071.8 Ops/sec
native check 1
6846872.0 Ops/sec
native check 2
7209450.0 Ops/sec
HTML Preparation code:
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.13.6/underscore-min.js" integrity="sha512-2V49R8ndaagCOnwmj8QnbT1Gz/rie17UouD9Re5WxbzRVUGoftCu5IuqqtAM9+UC3fwfHCSJR1hkzNQh/2wdtg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
Script Preparation code:
var MyObject = { description: 'a', myNumber: 123456789, myBoolean: true, }; var myString = "abcdef" var myCopy = null;
Tests:
underscore check 1
myCopy = _.isString(MyObject);
underscore check 2
myCopy = _.isString(myString);
native check 1
myCopy = typeof MyObject === 'string'
native check 2
myCopy = typeof myString === 'string'