title: jQuery and appending large amounts of HTML
body: <p>I have come to find that using jQuery to create HTML client-side can be a huge performance booster if done properly. I use AJAX returning JSON to retrieve dynamic content and then I build the relevant HTML and insert it using jQuery. The first time I messed with this technique I found that the string concatenator in IE's JavaScript performed really slowly so that building a dynamic table with more than 50 or so rows performed terribly.  </p>
  
  <pre><code>var shtml = '&lt;table&gt;';
  for (var i = 0; i &lt; 100; i++) {
    shtml += '&lt;tr&gt;&lt;td&gt;A bunch of content&lt;/td&gt;&lt;/tr&gt;';
  }
  shtml += '&lt;/table&gt;';
  $('#myTable').append(shtml);
  </code></pre>
  
  <p>Then I found a technique for string concatenation that changed everything.  Instead of using the sting <code>+=</code> operator use arrays to do concatenation;</p>
  
  <pre><code>var shtml = ['&lt;table&gt;'];
  for (var i = 0; i &lt; 100; i++) { 
    shtml.push('&lt;tr&gt;&lt;td&gt;A bunch of content&lt;/td&gt;&lt;/tr&gt;');
  }
  shtml.push('&lt;/table&gt;');
  $('#myTable').append(shtml.join(''));
  </code></pre>
  
  <p>I found that performance improved significantly. Now, however, there is a ceiling of about 100 rows before I start to see the browser itself struggle with dynamically inserting so much content at once. Does anyone have any pointers or techniques that can be used to help me achieve the next performance boost for large sets of dynamic HTML?</p>