Script Preparation code:
AخA
 
var o = {'++':0, '--':1, '!=':2, '<<<':3, '>>':4};
var a = ['++', '--', '!=', '<<<', '>>'];
var s = '++--!=<<<>>';
var t = '<<<';
Tests:
  • Array indexOf

     
    var i = a.indexOf(t);
  • String indexOf

     
    var i = s.indexOf('-' + t + '-');
  • Object lookup

     
    var i = o[t];
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Array indexOf
    String indexOf
    Object lookup

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36
Chrome 94 on Windows
View result in a separate tab
Test name Executions per second
Array indexOf 5188898.5 Ops/sec
String indexOf 4670823.5 Ops/sec
Object lookup 4538908.5 Ops/sec