Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
For vs Foreach vs Do While vs While v2
(version: 0)
See who is faster
Comparing performance of:
For vs Foreach vs Do While vs While
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var array = new Array(100);
Tests:
For
for (var i = 0; n = array.length; i < n; ++i) { array[i]; }
Foreach
array.forEach(function(i) { array[i]; });
Do While
var i = 0; do { array[i]; i++; } while (i < 100);
While
var i = 0; while (i < 100) { array[i]; i++; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
For
Foreach
Do While
While
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?