Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Map vs Object.entries
only on a small collection
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0
Browser:
Firefox 126
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
map forEach
1368254.6 Ops/sec
map for of
914467.2 Ops/sec
Object.entries for of
682783.8 Ops/sec
Script Preparation code:
var obj = { 1: "ASDASDASDASD", 2: "ASDASDASDASDASDA", 3: "ASDASDASDASDAAA", 4: 5242, 5: "AAAAAA", 6: "asdasdasdasd", 7: [24342343, "sweet", "hello"], 8: [1, 2, 3, 4], 9: [1, 2, 3, 4, 5], 10: "AAA", 11: 5545, 12: "gutenTag" } var map = new Map(Object.entries(obj))
Tests:
map forEach
let total = 0 map.forEach((k, v) => { total += 1 })
map for of
let total = 0 for (const [key, val] of map){ total += 1 }
Object.entries for of
let total = 0 for (const [key, val] of Object.entries(obj)){ total += 1 }