Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Chrome 120
Mac OS X 10.15.7
Desktop
2 years ago
(Math.round(*10000)/10000).toString()
9.8M/s
toPrecision(4).toString()
9.5M/s
toFixed(4)
8.8M/s
View exact numbers
Test name Executions per second
(Math.round(*10000)/10000).toString() 9,844,115 Ops/sec
toPrecision(4).toString() 9,459,585 Ops/sec
toFixed(4) 8,810,650 Ops/sec
Script Preparation code:
Tests: