Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 YaBrowser/25.8.0.0 Safari/537.36
Browser:
Yandex Browser 25
Operating system:
Windows
Device Platform:
Desktop
Date tested:
8 months ago
Test name
Executions per second
Number
28.0 Ops/sec
parseInt
27.8 Ops/sec
>>0
29.0 Ops/sec
*1
29.4 Ops/sec
~~
29.5 Ops/sec
+
29.6 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)