title: Performance of jQuery.grep vs. Array.filter
body: <p>In a <a href="https://stackoverflow.com/q/14644693/1047823">question</a> it was discussed on how jQuery and native JS would perform against each other.</p>
  
  <p>While of course the vanilla solution performs a lot faster because it does not process the whole array I proposed the usage of <code>Array.filter</code> which I was pretty confident would be at least faster than <code>$.grep</code>.</p>
  
  <p>Surprisingly after adding it to the test I was taught a lesson: <strong><a href="http://jsperf.com/grep-vs-pure-js/8" rel="noreferrer">Testsuite</a></strong></p>
  
  <p><a href="http://jsperf.com/grep-vs-pure-js/7" rel="noreferrer">Edgecases</a> of course have a different outcome.</p>
  
  <p>Anyone having an idea why <code>$.grep</code> is supposed to be over 3 times faster than the native method <code>Arrray.filter</code>?</p>
  
  <p>Edit: I modified the test to use the <a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter#Compatibility" rel="noreferrer">filter shim from MDN</a> and the results are pretty interesting:</p>
  
  <ul>
  <li>Chrome: Even MDN shim is faster than the native method, jQuery way ahead  </li>
  <li>Firefox: shim a bit slower than native method, jQuery way ahead</li>
  </ul>
  
  <p>and finally a result like i was hoping it to see in </p>
  
  <ul>
  <li>Internet Explorer: 
  native method is the fastest, then jQuery, shim is slowest (perhaps this is just the result of IEs rather weak JS-engine...)</li>
  </ul>