Script Preparation code:
x
 
var reportsArr = [{
    id: `john`,
    text: `one`
}, {
    id: `jane`,
    text: `two`
}, {
    id: `bob`,
    text: `three`
}]
var reportsObj = {
    ['john']: {
        text: `one`
    },
    [`jane`]: {
        text: `two`
    },
    [`bob`]: {
        text: `three`
    }
}
var i = 0,
    count = 1000,
    jane;
Tests:
  • Array lookup

     
    for (i = 0; i < count; i++) {
      janeIndex = reportsArr.findIndex(el => el.id === 'jane');
    }
  • Obj lookuo

     
    for (i = 0; i < count; i++) {
      janeIndex = reportsObj['jane'];
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Array lookup
    Obj lookuo

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 years ago)
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0
Firefox 95 on Ubuntu
View result in a separate tab
Test name Executions per second
Array lookup 8520.1 Ops/sec
Obj lookuo 21190.8 Ops/sec