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
Bitwise invert2
431.1M/s
ParseInt
429.1M/s
Bitwise conditional invert2
402.3M/s
Number.toFixed
12.9M/s
View exact numbers
Test name
Executions per second
✓
Bitwise invert2
431,077,280 Ops/sec
ParseInt
429,066,080 Ops/sec
Bitwise conditional invert2
402,293,792 Ops/sec
Number.toFixed
12,921,972 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);