For (backwards) vs While (backwards)

Edit on GitHub

Compare while vs for in looping over a list

Setup

var i = 1000;
var j = 0;

Tests

  • For (backwards)

    for (; i > -1; i--) j++;
  • While (backwards)

    while (i--) j++;