toString vs JSON.stringifyFastest: toString (9.5x faster)
50,632,792 ops/sec
5,341,854 ops/sec
Fastest: toString (46.9x faster)
112,119,120 ops/sec
2,391,621 ops/sec
Fastest: toString (8.3x faster)
34,654,400 ops/sec
4,189,020 ops/sec
Fastest: toString (11.3x faster)
91,670,904 ops/sec
8,077,712 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 |
| Test name | Executions per second |
|---|---|
| ✓ toString | 4,950,864 Ops/sec |
| JSON.stringify | 156,721 Ops/sec |