Script Preparation code:
Tests:

Historical Performance Data aggregated from 32 community runs

Desktop Results:
Chrome 27 runs
Object lookup
38.1M/s
String indexOf
35.8M/s
Array indexOf
19.3M/s

Fastest: Object lookup (2.0x faster)

View exact numbers
  • Object lookup: 38,088,264 ops/sec
  • String indexOf: 35,817,700 ops/sec
  • Array indexOf: 19,310,602 ops/sec
Firefox 5 runs
Object lookup
850.8M/s
String indexOf
784.8M/s
Array indexOf
33.4M/s

Fastest: Object lookup (25.5x faster)

View exact numbers
  • Object lookup: 850,781,504 ops/sec
  • String indexOf: 784,756,672 ops/sec
  • Array indexOf: 33,412,440 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 indexOf
    String indexOf
    Object lookup

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Chrome 134 on Linux
View result in a separate tab
String indexOf
157.0M/s
Object lookup
149.1M/s
Array indexOf
78.8M/s
View exact numbers
Test name Executions per second
String indexOf 156,970,352 Ops/sec
Object lookup 149,132,320 Ops/sec
Array indexOf 78,815,256 Ops/sec