template string vs JSON.stringify array vs JSON.stringify objectFastest: template string (22.8x faster)
161,005,760 ops/sec
9,003,158 ops/sec
7,074,654 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| template string | |
| JSON.stringify array | |
| JSON.stringify object |
| Test name | Executions per second |
|---|---|
| ✓ template string | 93,713,312 Ops/sec |
| JSON.stringify array | 255,905 Ops/sec |
| JSON.stringify object | 202,542 Ops/sec |