title: How do I match this text faster?
body: <p>I'm building an autosuggest for names. When the user types in the textbox, it hits the server and runs this:</p>
  
  <pre><code>var names = [ list of 1000 names ]; //I have a list of 1000 names, this is static.
  var query = 'alex';
  var matched_names = [];
  
  //This is when it gets slow....
  names.forEach(function(name){
      if(name.indexOf(query) &gt;= 0){
          matched_names.push(name);
      }
  });
  
  return matched_names;
  </code></pre>
  
  <p>How can I make this faster? I'm using Node.js</p>