Script Preparation code:
x
 
globalThis.map = []
globalThis.objArr = []
for (let i = 0; i < 20; i++) {
    const shardKey = String(i).slice(0,2)
    if (!map[`thing-${shardKey}`]) map[`thing-${shardKey}`] = []
    map[`thing-${shardKey}`][String(i)] = { i }
    objArr.push({ i })
}
Tests:
  • string map

     
    const v = map['thing-5']['5']
    console.log(v)
    delete map['thing-5']['5']
  • find

     
      for (let i = objArr.length - 1; i >= 0; i--) {
        const v = objArr[i]
        if (v.i === 5) {
          objArr.splice(i, 1)
          console.log(v)
          return v
        }
      }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    string map
    find

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.79 Safari/537.36
Chrome 104 on Linux
View result in a separate tab
Test name Executions per second
string map 68488.0 Ops/sec
find 200049.1 Ops/sec