title: Why is lodash.each faster than native forEach?
body: <p>I was trying to find the fastest way of running a for loop with its own scope. The three methods I compared were:</p>
  
  <pre><code>var a = "t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t,t".split();
  
  // lodash .each -&gt; 1,294,971 ops/sec
  lodash.each(a, function(item) { cb(item); });
  
  // native .forEach -&gt; 398,167 ops/sec
  a.forEach(function(item) { cb(item); });
  
  // native for -&gt; 1,140,382 ops/sec
  var lambda = function(item) { cb(item); };
  for (var ix = 0, len = a.length; ix &lt; len; ix++) {
    lambda(a[ix]);
  }
  </code></pre>
  
  <p>This is on Chrome 29 on OS X. You can run the tests yourself here:</p>
  
  <p><a href="http://jsben.ch/BQhED" rel="noreferrer">http://jsben.ch/BQhED</a></p>
  
  <p>How is lodash's <code>.each</code> almost twice as fast as native <code>.forEach</code>? And moreover, how is it faster than the plain <code>for</code>? Sorcery? Black magic?</p>