toString vs JSON.stringify vs Array.join1,254,685 ops/sec
1,205,235 ops/sec
1,172,894 ops/sec
Fastest: toString (2.3x faster)
4,675,918 ops/sec
2,544,673 ops/sec
2,070,488 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| toString | |
| JSON.stringify | |
| Array.join |
| Test name | Executions per second |
|---|---|
| ✓ Array.join | 2,724,909 Ops/sec |
| toString | 2,254,464 Ops/sec |
| JSON.stringify | 1,079,823 Ops/sec |