Script Preparation code:
x
 
globalThis.map = []
globalThis.objArr = []
for (let i = 0; i < 10000; 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-10']['100']
    console.log(v)
    delete map['thing-10']['100']
  • find

     
      for (let i = objArr.length - 1; i >= 0; i--) {
        const v = objArr[i]
        if (v.i === 100) {
          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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36
Chrome 104 on Windows
View result in a separate tab
Test name Executions per second
string map 176048.8 Ops/sec
find 491.6 Ops/sec