Script Preparation code:
AخA
 
var arr = new Array(15000);
arr.fill('')
arr = arr.map(el => Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 8));
var foo = 'erjhfdjh';
arr[7500]=foo;
var obj = arr.reduce((acc,key,i)=>{acc[key]=i;return acc},{});
Tests:
  • indexOf

     
    var index = arr.indexOf(foo);
  • findIndex

     
    var index = arr.findIndex(o => o===foo);
  • object property

     
    var index = obj[foo]
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    indexOf
    findIndex
    object property

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Mobile Safari/537.36
Chrome Mobile 116 on Android
View result in a separate tab
Test name Executions per second
indexOf 9665.4 Ops/sec
findIndex 242.3 Ops/sec
object property 937580.4 Ops/sec