HTML Preparation code:
Script Preparation code:
Tests:

Historical Performance Data aggregated from 417 community runs

Desktop Results:
Chrome 294 runs
indexOf start
13K/s
indexOf end
13K/s
startsWith
1K/s
endsWith
1K/s
regex start
616/s
regex end
557/s

Fastest: indexOf start (23.5x faster)

View exact numbers
  • indexOf start: 13,079 ops/sec
  • indexOf end: 12,785 ops/sec
  • startsWith: 1,149 ops/sec
  • endsWith: 1,142 ops/sec
  • regex start: 616 ops/sec
  • regex end: 557 ops/sec
Firefox 79 runs
indexOf end
15K/s
indexOf start
15K/s
startsWith
1K/s
endsWith
1K/s
regex start
729/s
regex end
700/s

Fastest: indexOf end (21.9x faster)

View exact numbers
  • indexOf end: 15,313 ops/sec
  • indexOf start: 15,143 ops/sec
  • startsWith: 1,218 ops/sec
  • endsWith: 1,215 ops/sec
  • regex start: 729 ops/sec
  • regex end: 700 ops/sec
Safari 13 runs
indexOf start
2K/s
regex start
372/s
startsWith
340/s
indexOf end
252/s
endsWith
249/s
regex end
201/s

Fastest: indexOf start (10.2x faster)

View exact numbers
  • indexOf start: 2,045 ops/sec
  • regex start: 372 ops/sec
  • startsWith: 340 ops/sec
  • indexOf end: 252 ops/sec
  • endsWith: 249 ops/sec
  • regex end: 201 ops/sec
Other 6 runs
indexOf start
1K/s
indexOf end
952/s
endsWith
141/s
startsWith
123/s
regex start
110/s
regex end
90/s

Fastest: indexOf start (11.7x faster)

View exact numbers
  • indexOf start: 1,051 ops/sec
  • indexOf end: 952 ops/sec
  • endsWith: 141 ops/sec
  • startsWith: 123 ops/sec
  • regex start: 110 ops/sec
  • regex end: 90 ops/sec
Mobile Results:
Chrome 19 runs
indexOf start
5K/s
indexOf end
4K/s
startsWith
820/s
endsWith
816/s
regex start
375/s
regex end
339/s

Fastest: indexOf start (16.2x faster)

View exact numbers
  • indexOf start: 5,497 ops/sec
  • indexOf end: 4,377 ops/sec
  • startsWith: 820 ops/sec
  • endsWith: 816 ops/sec
  • regex start: 375 ops/sec
  • regex end: 339 ops/sec
Safari 6 runs
indexOf start
2K/s
regex start
451/s
endsWith
368/s
startsWith
338/s
regex end
290/s
indexOf end
279/s

Fastest: indexOf start (5.9x faster)

View exact numbers
  • indexOf start: 1,641 ops/sec
  • regex start: 451 ops/sec
  • endsWith: 368 ops/sec
  • startsWith: 338 ops/sec
  • regex end: 290 ops/sec
  • indexOf end: 279 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    regex start
    startsWith
    regex end
    endsWith
    indexOf start
    indexOf end

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one month ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36 Edg/149.0.0.0
Chrome 149 on Windows
View result in a separate tab
indexOf end
8K/s
indexOf start
1K/s
startsWith
969/s
endsWith
947/s
regex start
570/s
regex end
357/s
View exact numbers
Test name Executions per second
indexOf end 8,269 Ops/sec
indexOf start 1,087 Ops/sec
startsWith 969 Ops/sec
endsWith 947 Ops/sec
regex start 570 Ops/sec
regex end 357 Ops/sec