Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
JS forEach vs for ... of Set
(version: 1)
compare between forEach and for ... of
Comparing performance of:
forEach vs for ... of
Created:
4 months ago
by:
Guest
Jump to the latest result
Script Preparation code:
x = new Set([1,2,3,4,5])
Tests:
forEach
var y x.forEach(i => {y = i})
for ... of
var y for (const i of x) { y = i }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
forEach
for ... of
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:147.0) Gecko/20100101 Firefox/147.0
Browser/OS:
Firefox 147 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
forEach
10690022.0 Ops/sec
for ... of
8914678.0 Ops/sec
Related benchmarks:
JS forEach vs for ... of
foreach vs for vs for in
foreach vs for..of
for vs foreach vs some vs for..of - henrique
.forEach vs for const of
Get index with forEach vs for...of over entries
foreach vs for...of
for vs foreach vs for..of vs for..in
for vs foreach123
Comments
Confirm delete:
Do you really want to delete benchmark?