Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Compare the ways to convert String to Number in JS
Compare the most popular ways to convert string to number
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 18_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.3 Mobile/15E148 Safari/604.1
Browser:
Mobile Safari 26
Operating system:
iOS 18.7
Device Platform:
Mobile
Date tested:
4 months ago
Benchmark engine:
Benchmark.js
Number
426/s
parseInt
377/s
>>0
306/s
~~
286/s
*1
260/s
+
259/s
View exact numbers
Test name
Executions per second
✓
Number
426 Ops/sec
parseInt
377 Ops/sec
>>0
306 Ops/sec
~~
286 Ops/sec
*1
260 Ops/sec
+
259 Ops/sec
Script Preparation code:
const minimum = 1 const maximum = 1000 var arr = Array.from({ length: 1000000 }, () => Math.floor(Math.random() * (maximum - minimum + 1)) + minimum)
Tests:
Number
return arr.map((el) => Number(el))
parseInt
return arr.map((el) => parseInt(el))
>>0
return arr.map((el) => el >> 0)
*1
return arr.map((el) => el * 1)
~~
return arr.map((el) => ~~el)
+
return arr.map((el) => +el)