Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
JS forEach vs for ... of
compare between forEach and for ... of
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:153.0) Gecko/20100101 Firefox/153.0
Browser:
Firefox 153
Operating system:
Linux
Device Platform:
Desktop
Date tested:
2 days ago
forEach
15.7M/s
for ... of
7.0M/s
View exact numbers
Test name
Executions per second
✓
forEach
15,672,176 Ops/sec
for ... of
7,021,193 Ops/sec
Script Preparation code:
x = [1,2,3,4,5]
Tests:
forEach
y = [] x.forEach(i => y.push(i))
for ... of
y = [] for (const i of x) { y.push(i) }