parseInt vs toFixed vs tilde vs bitwise
one month ago
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Test name |
Executions per second |
parseInt |
56.4 Ops/sec |
toFixed |
55.0 Ops/sec |
Tilde |
55.6 Ops/sec |
Bitwise |
61.8 Ops/sec |
Math.round |
59.0 Ops/sec |
Math.trunc |
64.3 Ops/sec |
Tests:
-
parseInt
-
toFixed
-
Tilde
-
Bitwise
-
Math.round
-
Math.trunc
Open this result on MeasureThat.net