JS startsWith vs JS includes vs JS substringFastest: JS includes (2.0x faster)
5,989 ops/sec
4,986 ops/sec
3,000 ops/sec
Fastest: JS startsWith (2.1x faster)
3,528 ops/sec
3,514 ops/sec
1,657 ops/sec
Fastest: JS startsWith (1.8x faster)
17,490 ops/sec
11,550 ops/sec
9,602 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| JS startsWith | |
| JS includes | |
| JS substring |
| Test name | Executions per second |
|---|---|
| ✓ JS substring | 58,333 Ops/sec |
| JS includes | 54,169 Ops/sec |
| JS startsWith | 26,844 Ops/sec |