Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
map vs array accessor
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36
Browser:
Chrome 143
Operating system:
Windows
Device Platform:
Desktop
Date tested:
4 months ago
Test name
Executions per second
Accessing random index in array
5960724.0 Ops/sec
Accessing random index in map
6482780.0 Ops/sec
Script Preparation code:
window.ITEMS_ARRAY = Array(1000).fill(null).map((item, index) => { return { id: index, name: '10 Portable DVD player', description: 'diam neque vestibulum eget vulputate', price: { value: 66.04, currency: 'CNY' }, status: 'Stocked on demand', statusColor: 'informative', date: new Date(), verified: true }; }); window.ITEMS_MAP = new Map(ITEMS_ARRAY.map((item, index) => [index, item])); window.initialIndex = Math.floor(Math.random() * 500); window.indexes = new Array(500).fill(null).map((item, index) => window.initialIndex + index);
Tests:
Accessing random index in array
window.indexes.forEach((index) => { const smt = window.ITEMS_ARRAY[index]; });
Accessing random index in map
window.indexes.forEach((index) => { const smt = window.ITEMS_MAP.get(index); });