Compare looking up values in a Map vs a plain Object.
const size = 10000;
const map = new Map();
const obj = {};
for (let i = 0; i < size; i++) {
map.set('key' + i, i);
obj['key' + i] = i;
}
const target = 'key' + (size / 2);Initializing...
| Test Case | Ops/sec | |
|---|---|---|
| Map.get | | ready |
| Object lookup | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.