Script Preparation code:
Tests:

Historical Performance Data aggregated from 32 community runs

Desktop Results:
Chrome 27 runs
Using a Set
742/s
Using indexOf
169/s
Using lastIndexOf
142/s

Fastest: Using a Set (5.2x faster)

View exact numbers
  • Using a Set: 742 ops/sec
  • Using indexOf: 169 ops/sec
  • Using lastIndexOf: 142 ops/sec
Firefox 5 runs
Using a Set
521/s
Using indexOf
222/s
Using lastIndexOf
218/s

Fastest: Using a Set (2.4x faster)

View exact numbers
  • Using a Set: 521 ops/sec
  • Using indexOf: 222 ops/sec
  • Using lastIndexOf: 218 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
    Using indexOf
    Using lastIndexOf
    Using a Set

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 9 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36
Chrome 141 on Windows
View result in a separate tab
Using a Set
904/s
Using indexOf
443/s
Using lastIndexOf
289/s
View exact numbers
Test name Executions per second
Using a Set 904 Ops/sec
Using indexOf 443 Ops/sec
Using lastIndexOf 289 Ops/sec