Performance for, foreach and for key
Well, here's some tips:


Never use for-in for arrays. for-in runs through the array properties.

var a = [1,2,3]
a.foo = 'bar'; // arrays are still objects
for(var i in a){console.log(i)} // will run over foo

forEach though native, but AFAIK is still slow compared to while and for. Some say it suffers the same overhead of calling a function (activation records, stack, scope lookup etc.)
Consider async instead. By the looks of it, you want to loop through an array as fast as possible to avoid freezing the browser. You can go with WebWorkers, or Timers. Here's an example using setInterval. It's not as fast as loops, but you won't be seeing those "Unresponsive script" and "He's dead Jim!" warnings:

var i = 1000000;
var looper = setInterval(function(){
  /* do something */

  if(!--i) clearInterval(looper);
},0);