Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Dict vs. Map vs. Array
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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36 Edg/141.0.0.0
Browser:
Chrome 141
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
6 months ago
Test name
Executions per second
Dictionary
456376.3 Ops/sec
Array
784336.6 Ops/sec
Map
284429.2 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 (i=2000; i<10000; i+=115) { c += dict['abc_'+i]}
Array
let c = 0 for (i=2000; i<10000; i+=115) { c += arr[i]}
Map
let c = 0 for (i=2000; i<10000; i+=115) { c += map.get('abc_'+i)}