Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
for of vs for loops
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.2 Safari/605.1.15
Browser:
Safari 26
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
7 months ago
for-index
2K/s
for-of
451/s
View exact numbers
Test name
Executions per second
✓
for-index
1,626 Ops/sec
for-of
451 Ops/sec
Script Preparation code:
const planes = new Array(1_000_000).fill(2);
Tests:
for-of
for (const plane of planes) { Math.sqrt(plane); }
for-index
for (let i = 0; i < planes.length; i++) { const plane = planes[i]; Math.sqrt(plane); }