Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
for of vs for loops 1k
(version: 1)
Comparing performance of:
for-of vs for-index
Created:
one year ago
by:
Registered User
Go to the latest result
Script Preparation code:
const planes = new Array(1_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); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
for-of
for-index
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Browser/OS:
Chrome 134 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
for-of
444K/s
for-index
246K/s
View exact numbers
Test name
Executions per second
✓
for-of
444,350 Ops/sec
for-index
245,994 Ops/sec
Related benchmarks
for vs for of vs for in
Loops for compared
for of vs for loops
for of vs for loops 10k
Comments
Confirm delete:
Do you really want to delete benchmark?