Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Chrome 120
Windows
Desktop
2 years ago
(Math.round(*10000)/10000).toString()
6.2M/s
toFixed(4) someFloat.toFixed(4); someFloat.t
3.6M/s
View exact numbers
Test name Executions per second
(Math.round(*10000)/10000).toString() 6,178,558 Ops/sec
toFixed(4) someFloat.toFixed(4); someFloat.t 3,563,536 Ops/sec
Script Preparation code:
Tests: