endWith vs slice vs hardcoded indexFastest: hardcoded index (1.2x faster)
157,135,344 ops/sec
155,728,864 ops/sec
126,989,776 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| endWith | |
| slice | |
| hardcoded index |
| Test name | Executions per second |
|---|---|
| ✓ hardcoded index | 415,152,960 Ops/sec |
| slice | 334,994,592 Ops/sec |
| endWith | 66,832,708 Ops/sec |