title: jQuery Autocomplete Performance
body: <p>I've implemented the jQuery UI Autocomplete function and am having noticible performance issues.</p>
  
  <p>Originally, I had it sending a new query on each character which is entered (but minimum 3 must be entered).</p>
  
  <p>My database is indexed, has 50k rows of data (5 columns). I have no performance issues at the DB level.</p>
  
  <p>One technique I decided to try was to cache the JSON and point autocomplete to that versus the database. This worked perfect... up to 2000 rows or so. Beyond that, it become slow and wonky.</p>
  
  <p>If anyone has a recommendation on techniques I would appreciate it.</p>
  
  <p>Here's some code to give you an idea of the Javascript.</p>
  
  <pre><code>// First, setup some data to iterate over. 
  // My thought is to query the DB once, and build this list in memory to avoid autocomplete hitting the database each keystroke.        
  
  var data = []; 
      data.push({value: "Person 1", label: "Person 1"});
      data.push({value: "Person 2", label: "Person 2"});
  
  $("#searchBox").autocomplete({
      source: data;
      minChars: 3;
      delay: 0;
  });
  </code></pre>