Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Reading Map vs Object/Record
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:155.0) Gecko/20100101 Firefox/155.0
Browser:
Firefox 155
Operating system:
Linux
Device Platform:
Desktop
Date tested:
9 days ago
Benchmark engine:
Benchmark.js
Map
4/s
Object/Record
3/s
View exact numbers
Test name
Executions per second
✓
Map
4 Ops/sec
Object/Record
3 Ops/sec
Script Preparation code:
let map = new Map(); let obj = {}; const ENTRIES = 1000000; const LOOKUPS = 300000; const RUNS = 4; const ids = Array.from({ length: ENTRIES }, () => crypto.randomUUID()); const lookupIds = Array.from({ length: LOOKUPS }, () => ids[Math.floor(Math.random() * (ENTRIES + 1))]); for (let i = 0; i < ENTRIES; i++) { map.set(ids[i], i); obj[ids[i]] = i; }
Tests:
Map
for (let j = 0; j < RUNS; j++) { let checksum = 0; for (let i = 0; i < LOOKUPS; i++) { checksum += map.get(lookupIds[i]); } console.log(checksum); }
Object/Record
for (let j = 0; j < RUNS; j++) { let checksum = 0; for (let i = 0; i < LOOKUPS; i++) { checksum += obj[lookupIds[i]]; } console.log(checksum); }