Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
For vs for of vs forEach
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 143
Operating system:
Android
Device Platform:
Mobile
Date tested:
7 months ago
forEach
3K/s
for loop
2K/s
reduce
2K/s
for of
641/s
View exact numbers
Test name
Executions per second
✓
forEach
3,244 Ops/sec
for loop
1,637 Ops/sec
reduce
1,619 Ops/sec
for of
641 Ops/sec
Script Preparation code:
var array = new Array(100000);
Tests:
for loop
let value; for (var i = 0; i < array.length; i++) { value = array[i]; }
forEach
let value; array.forEach(function(i) { value = i; });
for of
let value; for (var i of array) { value = i; }
reduce
const value = array.reduce((prev, current) => current, null)