Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Small Map vs Small Object.entries iteration
(version: 0)
A simple test comparing javascript maps vs object.entries on a small collection of values
Comparing performance of:
Map forEach vs Map for of vs Object.entries for of
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
const 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" } const 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 }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Map forEach
Map for of
Object.entries for of
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?