Script Preparation code:
AخA
 
list = Array.from({
    length: 1000
}, (v, i) => ({
    id: 'id' + i
}));
obj = list.reduce((acc, cur) => {
    acc[cur.id] = cur;
    return acc;
}, {});
Tests:
  • update in array

    x
     
    const list2 = list.map(item => item.id === 'id500' ? {...item, updated: true} : item)
  • update in obj

     
    const obj2 = {...obj, id500: {...obj['id500'], updated: true}}
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    update in array
    update in obj

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36
Chrome 85 on Mac OS X 10.15.2
View result in a separate tab
Test name Executions per second
update in array 101810.4 Ops/sec
update in obj 1503.3 Ops/sec