Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36
Chrome 139
Windows
Desktop
one year ago
Benchmark.js
Math.floor fast
68.7M/s
(Math.round(*10000)/10000).toString()
67.5M/s
toPrecision(4).toString()
8.1M/s
toFixed(4)
4.4M/s
View exact numbers
Test name Executions per second
Math.floor fast 68,666,472 Ops/sec
(Math.round(*10000)/10000).toString() 67,501,424 Ops/sec
toPrecision(4).toString() 8,061,111 Ops/sec
toFixed(4) 4,404,910 Ops/sec
Script Preparation code:
Tests: