title: Fastest method to filter an array for typeahead
body: <p>I am wondering what the fastest way to filter an array of objects for a typeahead is?</p>
  
  <p>Given a list of 10000 or more items similiar to this:</p>
  
  <pre><code>[{name: "ben"}, {name: "Alex"}, {name: "mary"}]
  </code></pre>
  
  <p>I can filter them for a typeahead using the <code>Array.prototype.filter</code> method, but I'm seeing quite a bit of lag time before getting results back. Is there a better way to filter large lists based on keyboard input?</p>
  
  <p>Here is my current implemenation:</p>
  
  <pre><code>const list = [{...}] //list of 10000 or more objects with a name property
  
  function getFilteredList(input) {
      const reg = new RegExp(input.toLowerCase(), 'i');
      return list.filter(i =&gt; reg.test(i.name));
  }
  </code></pre>
  
  <p>Is there a way to filter a list that is faster or has better performance than using the <code>Array.prototype.filter</code> method?</p>