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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
Browser:
Chrome 125
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
map forEach
1999169.2 Ops/sec
map for of
2842814.5 Ops/sec
Object.entries for of
534745.3 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 }