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 (X11; Linux aarch64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/60.5 Safari/605.1.15
Browser:
Safari 60
Operating system:
Linux
Device Platform:
Desktop
Date tested:
7 months ago
Test name
Executions per second
for loop
4578.1 Ops/sec
forEach
27.4 Ops/sec
for of
1663.3 Ops/sec
reduce
27.5 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)