Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Dict vs. Map vs. Array ( complete iteration)
Large dictionary - how worse is it from array with direct reference? And how does Map perform?
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/132.0.0.0 Safari/537.36
Browser:
Chrome 132
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Dictionary
211.7 Ops/sec
Array
5330.6 Ops/sec
Map
7465.8 Ops/sec
Script Preparation code:
var dict= {} for (var i=0; i<50000; i++) { dict['abc_'+i] = i; } var map= new Map() for (var i=0; i<50000; i++) { map.set('abc_'+i, i); } var arr = [] for (var i=0; i<50000; i++) { arr.push(i); }
Tests:
Dictionary
let c = 0 for (let key in dict) { c += dict[key]}
Array
let c = 0 for (i=0; i<10000; i+=1) { c += arr[i]}
Map
let c = 0 for (let [key, entry] of map) { c += entry}