Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
for vs for-of vs forEach
Test speed of iterating over an array
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Android 15; Mobile; rv:149.0) Gecko/149.0 Firefox/149.0
Browser:
Firefox Mobile 149
Operating system:
Android
Device Platform:
Mobile
Date tested:
one month ago
Test name
Executions per second
for
641.1 Ops/sec
for-of
597.2 Ops/sec
forEach
554.3 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
var objects = new Array(100_000).fill(0).map(()=>({}));
Tests:
for
for (var i = 0; i < objects.length; ++i) { objects[i].value = 'a'; }
for-of
for(const o of objects) { o.value = 'a' }
forEach
objects.forEach(o => { o.value = 'a'; })