Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
loopssadsadad
(version: 0)
Comparing performance of:
map vs for of vs forEach
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
var arr = new Array(100).fill(1);
Tests:
map
arr.map((el) => el + 1)
for of
for(const ele of arr) {console.log(ele)}
forEach
arr.forEach((ele) => console.log(ele));
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
map
for of
forEach
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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
Browser/OS:
Chrome 128 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
map
3522556.8 Ops/sec
for of
3275.7 Ops/sec
forEach
2110.6 Ops/sec
Related benchmarks:
loop length recalculation
fill-fast
TypedArray fill vs loop
Fill Array
Comments
Confirm delete:
Do you really want to delete benchmark?