Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
for of vs for loops 5
(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(10_000).fill(10000);
Tests:
for-of
for (const plane of planes) { const a = plane + plane; }
for-index
for (let i = 0; i < planes.length; i++) { const plane = planes[i]; const a = plane + 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; rv:137.0) Gecko/20100101 Firefox/137.0
Browser/OS:
Firefox 137 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
for-index
112K/s
for-of
21K/s
View exact numbers
Test name
Executions per second
✓
for-index
112,223 Ops/sec
for-of
20,699 Ops/sec
Related benchmarks
for of vs for loops
for of vs for loops 10k
for of vs for loops 1k
for of vs for loops 2
for of vs for loops 3
for of vs for loops 4
Comments
Confirm delete:
Do you really want to delete benchmark?