Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Map for map vs entries.map
(version: 0)
Comparing performance of:
Map - for of kv vs Map - forEach
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
var obj = { a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8, i: 9, j: 10, k: 11, l: 12, m: 13, n: 14, o: 15, p: 16, q: 17, r: 18, s: 19, t: 20, u: 21, v: 22, w: 23, x: 24, y: 25, z: 26 }; var map = new Map(Object.entries(obj));
Tests:
Map - for of kv
const arr = []; for (const [key, value] of map) { arr.push(value) }
Map - forEach
const arr = map.entries().map((value) => value);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Map - for of kv
Map - forEach
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0
Browser/OS:
Chrome 131 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Map - for of kv
7650188.0 Ops/sec
Map - forEach
58538128.0 Ops/sec
Related benchmarks:
Map Value Iteration
map iteration
map iteration 2
Map iterator
Object iteration vs Map iteration new
Map iteration vs Map.values() iteration
Mapping of Map: for of VS destructuring of values
Comments
Confirm delete:
Do you really want to delete benchmark?