toLocaleString vs Intl.NumberFormat vs string split & reduce vs toFixed vs bignumber vs numberWithCommasFastest: toFixed (210.6x faster)
15,982,369 ops/sec
6,489,958 ops/sec
3,050,792 ops/sec
1,760,352 ops/sec
80,671 ops/sec
75,876 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| toLocaleString | |
| Intl.NumberFormat | |
| string split & reduce | |
| toFixed | |
| bignumber | |
| numberWithCommas |
| Test name | Executions per second |
|---|---|
| ✓ toFixed | 15,982,369 Ops/sec |
| string split & reduce | 6,489,958 Ops/sec |
| numberWithCommas | 3,050,792 Ops/sec |
| bignumber | 1,369,880 Ops/sec |
| toLocaleString | 65,074 Ops/sec |
| Intl.NumberFormat | 62,802 Ops/sec |