Tests:
-
toFixed(4)
-
toPrecision(4).toString()
-
(Math.round(*10000)/10000).toString()
-
Math.floor fast
-
precisition round
Rendered benchmark preparation results:
Latest run results:
Run details: (Test run date:
7 months ago)
Mozilla/5.0 (X11; Linux x86_64; rv:144.0) Gecko/20100101 Firefox/144.0
Firefox 144 on Linux
View result in a separate tab
(Math.round(*10000)/10000).toString()
787.5M/s
precisition round
748.8M/s
toPrecision(4).toString()
9.3M/s
View exact numbers
| Test name |
Executions per second |
|
✓
(Math.round(*10000)/10000).toString()
|
787,530,688 Ops/sec |
|
Math.floor fast
|
777,832,256 Ops/sec |
|
precisition round
|
748,847,936 Ops/sec |
|
toFixed(4)
|
13,354,571 Ops/sec |
|
toPrecision(4).toString()
|
9,280,721 Ops/sec |
Do you really want to delete benchmark?