title: Why are native array functions are so much slower then loop
body: <p>The question is in the title, but here is a longer explanation.</p>
  
  <p>Long time ago I learned some nice javascript functions like reduce, filter, map <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter">and so on</a>. I really liked them and started to use them frequently (they look stylish and I thought that because they are native functions they should be faster than my old for loops).</p>
  
  <p>Recently I needed to perform some heavy js computations, so I decided to check how faster are they and to my surprise they are not faster, they are <strong>much much slower (from 3 to 25 times slower)</strong></p>
  
  <p>Also I have not checked for every function by here are my jsperf tests for:</p>
  
  <ul>
  <li><a href="http://jsperf.com/filter-and-loop">filter</a> (25 times slower)</li>
  <li><a href="http://jsperf.com/reduce-and-loop">reduce</a> (3 times slower)</li>
  <li><a href="http://jsperf.com/map-and-loop1">map</a> (3 times slower)</li>
  </ul>
  
  <p>So why are native functions are so much slower then old loops and what was the point of creating them if they are not doing anything better.</p>
  
  <p>I assume that the speed loss is due to the invocation of the function inside of them, but still it does not justify such loss. Also I can not see why the code written with these functions is more readable, not to mention, that they are not supported in every browser.</p>