Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Chrome 127
Linux
Desktop
2 years ago
Benchmark.js
Math.floor fast
13.2M/s
(Math.round(*10000)/10000).toString()
5.1M/s
toPrecision(4).toString()
4.7M/s
toFixed(4)
3.9M/s
View exact numbers
Test name Executions per second
Math.floor fast 13,172,646 Ops/sec
(Math.round(*10000)/10000).toString() 5,115,640 Ops/sec
toPrecision(4).toString() 4,742,420 Ops/sec
toFixed(4) 3,854,883 Ops/sec
Script Preparation code:
Tests: