title: JQuery's appendTo is very slow!
body: <p>I have a html table that I reorder based on a CSV list of custom attribute values that I have for each table row. I am using the following function to do it:</p>
  
  <pre><code>for (var i = 0; i &lt; arrCSV.length; i++)
  {
    $('#' + tableId)
        .find('[fname = ' + arrCSV[i] + ']')
        .eq(0)
        .parents('tr')
        .eq(0)
        .appendTo('#' + tableId);
  }
  </code></pre>
  
  <p>The table structure is:</p>
  
  <pre><code>&lt;table&gt;
  &lt;tr&gt;
   &lt;td fname='f1'&gt;something here&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
   &lt;td fname='f2'&gt;something here&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>The CSV could be something like this "f2, f1"</p>
  
  <p>I find this is very very slow performing function. Any help in optimizing it is really appreciated.</p>
  
  <p><strong>EDIT:
  Based on the article at <a href="http://www.learningjquery.com/2009/03/43439-reasons-to-use-append-correctly" rel="nofollow noreferrer">http://www.learningjquery.com/2009/03/43439-reasons-to-use-append-correctly</a>, one can achieve the greatest boost in performance by calling append only once with the html concatenated string. Can someone help in using this technique to my problem? I am not sure how to go about getting the s HTML in the for loop and appending it once.</strong></p>