Object

Benchmark created on


Setup

const map = new Map();
const object = {};

for (let i = 0; i < 10000; ++i) {
    object[`key_${i}`] = 1;
}

for (let i = 0; i < 10000; ++i) {
    map.set(`key_${i}`, 1);
}

Test runner

Ready to run.

Testing in
TestOps/sec
Object
let result = 0;
  
for (let i = 0; i < 10000; ++i) {
    result += object[`key_${i}`];
}
ready
Map
let result = 0;

for (let i = 0; i < 10000; ++i) {
    result += map.get(`key_${i}`);
}
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.