Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
ParseInt vs conditional ~~ vs toFixed
ParseInt vs conditional ~~
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0
Browser:
Firefox 126
Operating system:
Ubuntu
Device Platform:
Desktop
Date tested:
one year ago
ParseInt
618.0M/s
Bitwise invert2
572.6M/s
Bitwise conditional invert2
500.1M/s
Number.toFixed
15.1M/s
View exact numbers
Test name
Executions per second
✓
ParseInt
617,981,504 Ops/sec
Bitwise invert2
572,627,648 Ops/sec
Bitwise conditional invert2
500,059,936 Ops/sec
Number.toFixed
15,107,920 Ops/sec
Script Preparation code:
var num = Math.random() * 2^32;
Tests:
ParseInt
parseInt(num);
Bitwise invert2
~~(num);
Bitwise conditional invert2
num > 2147483648 ? parseInt(num) : ~~(num);
Number.toFixed
num.toFixed(0);