Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
for loop speed comparison
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.4 Safari/605.1.15
Browser:
Safari 26
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
9 days ago
Test name
Executions per second
for
9085.8 Ops/sec
forEach
3016.1 Ops/sec
for of
7989.8 Ops/sec
Script Preparation code:
"use strict"; const arr = []; for (let i = 0; i < 10000; i++) { arr[i] = i; }
Tests:
for
"use strict"; let x = 0; for (let i = 0; i < 10000; i++) { x = arr[i] };
forEach
"use strict"; let x = 0; arr.forEach(function(i) { x = i });
for of
"use strict"; let x = 0; for (const i of arr) { x = i };