Native toString() vs Native toFixed(9) vs bignumber.js toString() vs bignumber.js toFixed(18) vs big.js toString() vs big.js toFixed(18) vs decimal.js toString() vs decimal.js toFixed(18)Fastest: Native toFixed(9) (143.9x faster)
39,231,052 ops/sec
39,037,840 ops/sec
381,951 ops/sec
357,442 ops/sec
328,054 ops/sec
326,852 ops/sec
316,740 ops/sec
272,548 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| Native toString() | |
| Native toFixed(9) | |
| bignumber.js toString() | |
| bignumber.js toFixed(18) | |
| big.js toString() | |
| big.js toFixed(18) | |
| decimal.js toString() | |
| decimal.js toFixed(18) |
| Test name | Executions per second |
|---|---|
| ✓ Native toFixed(9) | 45,412,636 Ops/sec |
| Native toString() | 44,923,888 Ops/sec |
| bignumber.js toFixed(18) | 431,243 Ops/sec |
| bignumber.js toString() | 428,724 Ops/sec |
| big.js toString() | 381,951 Ops/sec |
| decimal.js toString() | 328,328 Ops/sec |
| big.js toFixed(18) | 326,852 Ops/sec |
| decimal.js toFixed(18) | 296,146 Ops/sec |