Script Preparation code:
x
 
window.myMap = new Map();
window.myObj = new Map();
window.generateObj = () => ({
    'a': Math.random() * 10000,
    'b': Math.random() * 10000,
    'c': Math.random() * 10000
});
for (let i = 0; i < 1000; i++) {
    let id = 'id-' + i;
    let obj = generateObj();
    myMap.set(id, obj);
    myObj[id] = obj;
}
Tests:
  • Read from map

     
    let id = `id-` + Math.floor(Math.random() * 1000);
    let value = myMap.get(id);
  • Read from obj

     
    let id = `id-` + Math.floor(Math.random() * 1000);
    let value = myObj[id];
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Read from map
    Read from obj

    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/92.0.4515.107 Safari/537.36
Chrome 92 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Read from map 1749678.5 Ops/sec
Read from obj 1403757.0 Ops/sec