Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Map vs Object with 100 keys and mutate
Lookup of map vs object
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/604.1.38 (KHTML, like Gecko) Chrome/49.0.2623 Safari/604.1.38 CoherentGT/2.0
Browser:
Chrome 49
Operating system:
Windows 8
Device Platform:
Desktop
Date tested:
7 months ago
Test name
Executions per second
Map set
4958.7 Ops/sec
Obj set
5268.3 Ops/sec
Script Preparation code:
var map = new Map(); var obj = {}; const nbKeys = 100; for(let n =0; n<nbKeys; n++) { const nKey = n; const nValue = Math.random(); map.set(nKey, nValue ); obj[nKey] = nValue ; } var i = 0, count = 1000, a; function getRandomInt(max) { return Math.floor(Math.random() * max); }
Tests:
Map set
for (i = 0; i < count; i++) { map.set(getRandomInt(nbKeys), getRandomInt(42)); }
Obj set
for (i = 0; i < count; i++) { obj[getRandomInt(nbKeys)] = getRandomInt(42); }