Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
for vs foreach vs some vs for..of with modern variable declarations
(version: 0)
Compare loop performance
Comparing performance of:
for vs foreach vs some vs for..of
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
const array = new Array(100);
Tests:
for
for (let i = 0; i < array.length; i++) { array[i]; }
foreach
array.forEach(function(i) { array[i]; });
some
array.some(function(i) { array[i]; });
for..of
for (const i of array) { array[i]; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
for
foreach
some
for..of
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?