Round floating number using lodash round function vs Round floating number using toFixed() vs Round floating number using toFixed() and parseFloatFastest: Round floating number using toFixed() (3.0x faster)
8,156 ops/sec
4,789 ops/sec
2,719 ops/sec
Fastest: Round floating number using toFixed() (10.9x faster)
22,639 ops/sec
14,048 ops/sec
2,080 ops/sec
Fastest: Round floating number using toFixed() (4.2x faster)
9,972 ops/sec
5,834 ops/sec
2,390 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| Round floating number using lodash round function | |
| Round floating number using toFixed() | |
| Round floating number using toFixed() and parseFloat |
| Test name | Executions per second |
|---|---|
| ✓ Round floating number using toFixed() | 6,663 Ops/sec |
| Round floating number using toFixed() and parseFloat | 4,302 Ops/sec |
| Round floating number using lodash round function | 1,234 Ops/sec |