Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
javascript loops2
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Browser:
Chrome 130
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
foreach
3818.1 Ops/sec
for-in
2416.2 Ops/sec
for-of
3831.0 Ops/sec
for
2471.3 Ops/sec
optimized-for
2256.0 Ops/sec
Tests:
foreach
const items = Array.from({length: 500000}, () => Math.floor(Math.random() * 40)); let index = 0; items.forEach(i => index++);
for-in
const items = Array.from({length: 500000}, () => Math.floor(Math.random() * 40)); let index = 0; for (let i in items) { item = items[i] index++; }
for-of
const items = Array.from({length: 500000}, () => Math.floor(Math.random() * 40)); let index = 0; for (let i of items) { index++; }
for
const items = Array.from({length: 500000}, () => Math.floor(Math.random() * 40)); let index = 0; for(let i = 0; i < items.length; ++i) { item = items[i] index++; }