String() vs .toString() vs template stringFastest: template string (14.6x faster)
2,482,536 ops/sec
1,516,738 ops/sec
170,246 ops/sec
Fastest: .toString() (1.6x faster)
3,573,263 ops/sec
2,956,701 ops/sec
2,176,562 ops/sec
Fastest: .toString() (11.6x faster)
2,169,481 ops/sec
2,119,883 ops/sec
187,374 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| String() | |
| .toString() | |
| template string |
| Test name | Executions per second |
|---|---|
| ✓ .toString() | 4,407,829 Ops/sec |
| template string | 3,727,530 Ops/sec |
| String() | 3,136,214 Ops/sec |