Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
iterate over map vs array-backed map
(version: 1)
Comparing performance of:
map vs array-backed map
Created:
6 months ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const map = new Map([[1,null],[2, null],[3, null],[4, null]]) const array = [1,2,3,4] const mapWithArray = new Map([[1,null],[2, null],[3, null],[4, null]]) function getStructures() { return { map, array, mapWithArray } }
Tests:
map
const {map, array, mapWithArray} = getStructures() for (const [key, value] of map) { key; value; }
array-backed map
const {map, array, mapWithArray} = getStructures() for (const key of array) { key; mapWithArray.get(key) }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
map
array-backed map
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
6 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
Browser/OS:
Chrome 138 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
map
18945658.0 Ops/sec
array-backed map
53697336.0 Ops/sec
Related benchmarks:
For loop map vs map builtin for 10000000 elements
For loop map vs map builtin for 100000 elements
for vs map to fill array
for vs map to fill array fixed
iterate over array
MapOps
Map. foreach
Array.from vs map 1
iterate over map vs map entries vs map values vs array-backed map
Comments
Confirm delete:
Do you really want to delete benchmark?