Script Preparation code:
Tests:

Historical Performance Data aggregated from 26 community runs

Desktop Results:
Chrome 26 runs
String.includes
8.6M/s
ES6 Set
8.2M/s
Array.includes
7.4M/s
Object Hash-map
7.3M/s
Array.indexOf
7.1M/s

Fastest: String.includes (1.2x faster)

View exact numbers
  • String.includes: 8,581,778 ops/sec
  • ES6 Set: 8,206,495 ops/sec
  • Array.includes: 7,364,023 ops/sec
  • Object Hash-map: 7,329,218 ops/sec
  • Array.indexOf: 7,136,125 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
    Array.includes
    String.includes
    Object Hash-map
    ES6 Set
    Array.indexOf

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Chrome 135 on Mac OS X 10.15.7
View result in a separate tab
ES6 Set
268.2M/s
String.includes
257.1M/s
Object Hash-map
66.9M/s
Array.includes
31.1M/s
Array.indexOf
30.6M/s
View exact numbers
Test name Executions per second
ES6 Set 268,172,288 Ops/sec
String.includes 257,082,688 Ops/sec
Object Hash-map 66,896,252 Ops/sec
Array.includes 31,130,256 Ops/sec
Array.indexOf 30,618,432 Ops/sec