Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
for vs foreach vs for..in vs for..of jul 2025
Compare loop performance
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:141.0) Gecko/20100101 Firefox/141.0
Browser:
Firefox 141
Operating system:
Linux
Device Platform:
Desktop
Date tested:
9 months ago
Test name
Executions per second
for
682752.4 Ops/sec
foreach
661161.3 Ops/sec
for in
34468448.0 Ops/sec
for..of
133040.1 Ops/sec
Script Preparation code:
var array = new Array(1000);
Tests:
for
for (var i = 0; i < array.length; i++) { var x = array[i]; }
foreach
array.forEach((el)=> { var e = el; });
for in
for (var el in array) { var e = el; }
for..of
for (var el of array) { var e = el; }