Script Preparation code:
Tests:

Historical Performance Data aggregated from 20 community runs

Desktop Results:
Chrome 15 runs
String.prototype.indexOf
27.4M/s
String.prototype.includes
27.3M/s
View exact numbers
  • String.prototype.indexOf: 27,401,176 ops/sec
  • String.prototype.includes: 27,319,386 ops/sec
Firefox 5 runs
String.prototype.indexOf
1960.9M/s
String.prototype.includes
121K/s

Fastest: String.prototype.indexOf (16266.0x faster)

View exact numbers
  • String.prototype.indexOf: 1,960,882,176 ops/sec
  • String.prototype.includes: 120,551 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
    String.prototype.includes
    String.prototype.indexOf

    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
Chrome 138 on Windows
View result in a separate tab
String.prototype.includes
169.0M/s
String.prototype.indexOf
162.2M/s
View exact numbers
Test name Executions per second
String.prototype.includes 168,954,736 Ops/sec
String.prototype.indexOf 162,151,600 Ops/sec