Script Preparation code:
x
 
var items = Array.from(Array(1000), (_, x) => ({
    key: 'abcd',
    value: x * 10
}));
var itemsLong = Array.from(Array(1000), (_, x) => ({
    key: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
    value: x * 10
}));
var objContainer = {};
var objContainerLongKeys = {};
for (let i = 100; i >= 0; i--) {
    const index = Math.floor(Math.random() * 1000);
    const item = items[index];
    objContainer[item.key] = item;
    objContainerLongKeys[itemsLong.key] = item;
}
Tests:
  • Object access

     
    items.forEach(item => objContainer[item.value])
  • Object access (long key)

     
    items.forEach(item => objContainerLongKeys[item.value])
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Object access
    Object access (long key)

    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/95.0.4638.69 Safari/537.36
Chrome 95 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Object access 15948.9 Ops/sec
Object access (long key) 15417.4 Ops/sec