Script Preparation code:
Tests:

Historical Performance Data aggregated from 6 community runs

Desktop Results:
Chrome 6 runs
=== known length
189.4M/s
String.includes
184.0M/s
==
181.9M/s
startsWith
92.0M/s
RegEx.test
51.6M/s
String.match
9.7M/s

Fastest: === known length (19.4x faster)

View exact numbers
  • === known length: 189,410,976 ops/sec
  • String.includes: 183,971,360 ops/sec
  • ==: 181,894,848 ops/sec
  • startsWith: 91,959,544 ops/sec
  • RegEx.test: 51,608,328 ops/sec
  • String.match: 9,741,514 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.test
    String.includes
    String.match
    ==
    === known length
    startsWith

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 Edg/138.0.0.0
Chrome 138 on Windows
View result in a separate tab
String.includes
204.5M/s
=== known length
199.5M/s
==
181.2M/s
startsWith
90.3M/s
RegEx.test
54.5M/s
String.match
11.5M/s
View exact numbers
Test name Executions per second
String.includes 204,456,704 Ops/sec
=== known length 199,500,192 Ops/sec
== 181,193,424 Ops/sec
startsWith 90,295,720 Ops/sec
RegEx.test 54,454,748 Ops/sec
String.match 11,466,605 Ops/sec