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:145.0) Gecko/20100101 Firefox/145.0
Browser:
Firefox 145
Operating system:
Linux
Device Platform:
Desktop
Date tested:
5 months ago
Test name
Executions per second
for
1574301.0 Ops/sec
foreach
1140243.6 Ops/sec
for in
40866568.0 Ops/sec
for..of
231183.9 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; }