Script Preparation code:
AخA
 
var arrayStorage = new Array(5000).fill(0).map((v, i) => ({id: i, value: i}))
var mapStorage = new Map(arrayStorage.map((entry) => [entry.id, entry]))
var newItem = {id: 25, value: 222}
Tests:
  • Array

     
    var index = arrayStorage.findIndex((item) => item.id === newItem.id)
    arrayStorage = [...arrayStorage.slice(0, index), newItem, ...arrayStorage.slice(index+1)]
  • Map

     
    mapStorage.delete(newItem.id)
    arrayStorage = Array.from(mapStorage.values())
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Array
    Map

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36
Chrome 96 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Array 33677.5 Ops/sec
Map 43872.0 Ops/sec