forloop vs reverse while loop and array reverse (v3)

Revision 3 of this benchmark created on


Description

I know that reverse while looping in javascript is faster than for looping, but if order is to be maintained, would rev-while looping then reversing the array be faster or would the traditional for loop out perform this combo? (EDIT: removing call to console)

Preparation HTML

<script>
  var temp;
  var times;
</script>

Setup

temp = [];
    times = 10000;

Test runner

Ready to run.

Testing in
TestOps/sec
for loop
for (var i = 0; i < times; i++) {
  temp.push(i + 1);
}
ready
while loop with reverse for order
var i = times;
while (i--) {
  temp.push(i + 1);
}
temp.reverse();
 
ready
reversed for loop
for (var i = times; i > 0; i--) {
  temp.push(i);
}
temp.reverse();
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.