Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
looping thru set/map/array
(version: 1)
Comparing performance of:
set vs map vs array
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
let arr = Array.from({ length: 512 }, Date.now), set = new Set(arr), map = new Map(Object.entries(arr)) function forEach(g) { return g ** .5 }
Tests:
set
set.forEach(forEach)
map
map.forEach(forEach)
array
arr.forEach(forEach)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
set
map
array
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:136.0) Gecko/20100101 Firefox/136.0
Browser/OS:
Firefox 136 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
set
14419778.0 Ops/sec
map
248271.0 Ops/sec
array
480358.7 Ops/sec
Related benchmarks:
forEach vs map
for vs map to fill array fixed
iterate over array
array 1-100
Map looping
Map loop
Map looping2
Set vs Object add
Set replace
Comments
Confirm delete:
Do you really want to delete benchmark?