How to improve performance of inserting text into an HTML element?
<p>In Firefox, I am inserting text into ~500 DIVs using this code:</p>

<pre><code>$(".divs").text("default"); // ~500 DIVs
</code></pre>

<p>On my computer, this consistently takes <strong>9ms</strong> <em>if the DIVs are empty</em>. However, this same code consistently takes <strong>18ms</strong> <em>if the DIVs already contain text</em>.</p>

<p>Why is it that an empty DIV is 2x faster at inserting text (does jQuery need to empty the DIV first)? And, is there any way to improve the performance of replacing text in a DIV that already contains text?</p>

<p>Note: In IE 7, the speed differences were not as dramatic. Inserting text in an empty DIV was about 1.5x faster.</p>
