Script Preparation code:
Tests:

Historical Performance Data aggregated from 6 community runs

Desktop Results:
Chrome 6 runs
(Math.round(*10000)/10000)
153.3M/s
toPrecision(4).toString()
8.3M/s
toFixed(4)
6.2M/s

Fastest: (Math.round(*10000)/10000) (24.7x faster)

View exact numbers
  • (Math.round(*10000)/10000): 153,299,024 ops/sec
  • toPrecision(4).toString(): 8,317,891 ops/sec
  • toFixed(4): 6,205,516 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    toFixed(4)
    toPrecision(4).toString()
    (Math.round(*10000)/10000)

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 23 days ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/152.0.0.0 Safari/537.36
Chrome 152 on Windows
View result in a separate tab
(Math.round(*10000)/10000)
476.9M/s
toPrecision(4).toString()
6.4M/s
toFixed(4)
3.9M/s
View exact numbers
Test name Executions per second
(Math.round(*10000)/10000) 476,872,352 Ops/sec
toPrecision(4).toString() 6,367,108 Ops/sec
toFixed(4) 3,899,066 Ops/sec