title: Javascript fastest way to remove Object from Array
body: <p>Working on app where speed is crucial, the <strong>arrays are huge</strong> <em>and</em> the objects contained within the arrays. </p>
  
  <p>I experimented with <a href="http://api.jquery.com/jQuery.grep/" rel="noreferrer"><code>grep</code></a> and <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter" rel="noreferrer"><code>filter</code></a> and can not see significant speed difference, varies +- <em>5ms</em> , also tried looping through array and using <em><strong><code>.splice(i,1);</code></strong></em> (same results).</p>
  
  <p>I have a fast machine, if it always take more or less the same time on fast machine, does that mean it will take more or less same time on older machine?</p>
  
  <p>Is there faster way to remove an object from array?</p>
  
  <p>Want to do something like this:</p>
  
  <pre><code>var filterTime = performance.now();
  doStuff1();
  var filterTimeEnd = performance.now();
  
  var grepTime = performance.now();
  doStuff2();
  var grepTimeEnd = performance.now();
  </code></pre>
  
  <p>and then store the differences in cookie, so the next time the page loads or is refreshed, execute most efficient way: removing object from array.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p><em>snippet of filter experiment</em>                </p>
  
  <pre><code>      companyMasters = companyMasters.filter(function (obj) {
        return obj.masterId != CompanyObj.masterId;
        });
  </code></pre>