Script Preparation code:
Tests:

Historical Performance Data aggregated from 69 community runs

Desktop Results:
Chrome 58 runs
(Math.round(*10000)/10000).toString()
7.7M/s
toPrecision(4).toString()
7.2M/s
toFixed(4)
6.6M/s

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

View exact numbers
  • (Math.round(*10000)/10000).toString(): 7,703,244 ops/sec
  • toPrecision(4).toString(): 7,188,518 ops/sec
  • toFixed(4): 6,580,609 ops/sec
Firefox 11 runs
(Math.round(*10000)/10000).toString()
945.6M/s
toFixed(4)
17.9M/s
toPrecision(4).toString()
12.0M/s

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

View exact numbers
  • (Math.round(*10000)/10000).toString(): 945,572,032 ops/sec
  • toFixed(4): 17,930,714 ops/sec
  • toPrecision(4).toString(): 11,959,754 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).toString()

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 9 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:144.0) Gecko/20100101 Firefox/144.0
Firefox 144 on Windows
View result in a separate tab
(Math.round(*10000)/10000).toString()
2195.6M/s
toFixed(4)
20.3M/s
toPrecision(4).toString()
19.8M/s
View exact numbers
Test name Executions per second
(Math.round(*10000)/10000).toString() 2,195,602,176 Ops/sec
toFixed(4) 20,338,112 Ops/sec
toPrecision(4).toString() 19,812,680 Ops/sec