<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Increase DOM Node Insertion Performance</title>
	<atom:link href="http://ajaxian.com/archives/increase-dom-node-insertion-performance/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/increase-dom-node-insertion-performance</link>
	<description>Cleaning up the web with Ajax</description>
	<lastBuildDate>Thu, 17 May 2012 07:43:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: matanlurey</title>
		<link>http://ajaxian.com/archives/increase-dom-node-insertion-performance/comment-page-1#comment-266053</link>
		<dc:creator>matanlurey</dc:creator>
		<pubDate>Tue, 22 Jul 2008 18:29:33 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/increase-dom-node-insertion-performance#comment-266053</guid>
		<description>I think this is an interesting discovery, I myself wasn&#039;t aware the browser supported DocumentFragment object. I would say, however, that the most important thing in DOM node construction is to append child nodes to a &lt;b&gt;non-inserted&lt;/b&gt; parent node (such as a div).</description>
		<content:encoded><![CDATA[<p>I think this is an interesting discovery, I myself wasn&#8217;t aware the browser supported DocumentFragment object. I would say, however, that the most important thing in DOM node construction is to append child nodes to a <b>non-inserted</b> parent node (such as a div).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: p01</title>
		<link>http://ajaxian.com/archives/increase-dom-node-insertion-performance/comment-page-1#comment-265998</link>
		<dc:creator>p01</dc:creator>
		<pubDate>Mon, 21 Jul 2008 19:17:50 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/increase-dom-node-insertion-performance#comment-265998</guid>
		<description>DocumentFragment are the way to go when developing web applications for limited devices and mobile phones. See [1,2]

Also notice that since the documentFragment is not in the document itself, CSS are not applied to its elements. This means that you won&#039;t be able to fiddle with the getComputedStyle( aChildOfTheDocumentFragment ); and other style properties of the children of a documentFrament.


&lt;strong&gt;AnM8tR:&lt;/strong&gt; But in a more realistic scenario you would have a deeper DOM (sub)tree with various text nodes and attributes to touch. On devices and mobile phones, using a documentFragment vs many appendChild directly in the document makes a real difference.



[1] &lt;a href=&quot;http://dev.opera.com/articles/view/efficient-javascript/?page=3#modifyingtree&quot; rel=&quot;nofollow&quot;&gt;Efficient Javascript @ dev.opera&lt;/a&gt;
[2] &lt;a href=&quot;http://dev.opera.com/articles/view/cross-device-development-techniques-for/#domfragments&quot; rel=&quot;nofollow&quot;&gt;Cross device development techinques @ dev.opera&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>DocumentFragment are the way to go when developing web applications for limited devices and mobile phones. See [1,2]</p>
<p>Also notice that since the documentFragment is not in the document itself, CSS are not applied to its elements. This means that you won&#8217;t be able to fiddle with the getComputedStyle( aChildOfTheDocumentFragment ); and other style properties of the children of a documentFrament.</p>
<p><strong>AnM8tR:</strong> But in a more realistic scenario you would have a deeper DOM (sub)tree with various text nodes and attributes to touch. On devices and mobile phones, using a documentFragment vs many appendChild directly in the document makes a real difference.</p>
<p>[1] <a href="http://dev.opera.com/articles/view/efficient-javascript/?page=3#modifyingtree" rel="nofollow">Efficient Javascript @ dev.opera</a><br />
[2] <a href="http://dev.opera.com/articles/view/cross-device-development-techniques-for/#domfragments" rel="nofollow">Cross device development techinques @ dev.opera</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jdalton</title>
		<link>http://ajaxian.com/archives/increase-dom-node-insertion-performance/comment-page-1#comment-265993</link>
		<dc:creator>jdalton</dc:creator>
		<pubDate>Mon, 21 Jul 2008 17:58:29 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/increase-dom-node-insertion-performance#comment-265993</guid>
		<description>Prototype has recently had a patch re-submitted that uses documentFragment to increase the speed of Element#insert, Element#update, and Element#replace.
http://prototype.lighthouseapp.com/projects/8886/tickets/227-optimize-element-update-element-insert-and-element-replace-via-documentfragment .
The original ticket /w benchmarks http://dev.rubyonrails.org/ticket/11468 .

This offsers a huge performance boost to IE, taking delays of 60 seconds or more down to 1 second (equal to other browsers).

Hip Tip: If you cache the documentFragment you can use it over and over again without creating new ones.

- JDD</description>
		<content:encoded><![CDATA[<p>Prototype has recently had a patch re-submitted that uses documentFragment to increase the speed of Element#insert, Element#update, and Element#replace.<br />
<a href="http://prototype.lighthouseapp.com/projects/8886/tickets/227-optimize-element-update-element-insert-and-element-replace-via-documentfragment" rel="nofollow">http://prototype.lighthouseapp.com/projects/8886/tickets/227-optimize-element-update-element-insert-and-element-replace-via-documentfragment</a> .<br />
The original ticket /w benchmarks <a href="http://dev.rubyonrails.org/ticket/11468" rel="nofollow">http://dev.rubyonrails.org/ticket/11468</a> .</p>
<p>This offsers a huge performance boost to IE, taking delays of 60 seconds or more down to 1 second (equal to other browsers).</p>
<p>Hip Tip: If you cache the documentFragment you can use it over and over again without creating new ones.</p>
<p>- JDD</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AnM8tR</title>
		<link>http://ajaxian.com/archives/increase-dom-node-insertion-performance/comment-page-1#comment-265988</link>
		<dc:creator>AnM8tR</dc:creator>
		<pubDate>Mon, 21 Jul 2008 16:19:07 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/increase-dom-node-insertion-performance#comment-265988</guid>
		<description>I&#039;m afraid this test is misleading.

This blog did however get me to run some quick tests. All done on FF3 - not real official or anything. Each test I created 1000 divs with a small amount of text:

docFrag: 76ms
appendChild: 64ms
innerHTML: 40ms

The difference is, I created a container div, and inserted 1000 children and then appended the container to the body. This is much faster than appending every single child to the body one at a time. Appending the container to the body first, then appending 1000 children is 83ms.

&quot;createDocumentFragment&quot; is useful if you need to insert multiple &quot;loose&quot; children directly into a node. However, I usally prepare my code with containers that can be replaced.</description>
		<content:encoded><![CDATA[<p>I&#8217;m afraid this test is misleading.</p>
<p>This blog did however get me to run some quick tests. All done on FF3 &#8211; not real official or anything. Each test I created 1000 divs with a small amount of text:</p>
<p>docFrag: 76ms<br />
appendChild: 64ms<br />
innerHTML: 40ms</p>
<p>The difference is, I created a container div, and inserted 1000 children and then appended the container to the body. This is much faster than appending every single child to the body one at a time. Appending the container to the body first, then appending 1000 children is 83ms.</p>
<p>&#8220;createDocumentFragment&#8221; is useful if you need to insert multiple &#8220;loose&#8221; children directly into a node. However, I usally prepare my code with containers that can be replaced.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Schill</title>
		<link>http://ajaxian.com/archives/increase-dom-node-insertion-performance/comment-page-1#comment-265987</link>
		<dc:creator>Schill</dc:creator>
		<pubDate>Mon, 21 Jul 2008 15:53:56 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/increase-dom-node-insertion-performance#comment-265987</guid>
		<description>Indeed! :) documentFragment is my response to folks who commonly compare .innerHTML vs. appendChild(), where their examples include one .innerHTML update vs. document.body.appendChild(node) in a &quot;for&quot; loop or some such. (One would expect the latter will be slower of course, given the browser will be attempting to reflow the document with each loop iteration vs. once with a write to .innerHTML.)</description>
		<content:encoded><![CDATA[<p>Indeed! :) documentFragment is my response to folks who commonly compare .innerHTML vs. appendChild(), where their examples include one .innerHTML update vs. document.body.appendChild(node) in a &#8220;for&#8221; loop or some such. (One would expect the latter will be slower of course, given the browser will be attempting to reflow the document with each loop iteration vs. once with a write to .innerHTML.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jlecomte</title>
		<link>http://ajaxian.com/archives/increase-dom-node-insertion-performance/comment-page-1#comment-265986</link>
		<dc:creator>jlecomte</dc:creator>
		<pubDate>Mon, 21 Jul 2008 15:44:06 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/increase-dom-node-insertion-performance#comment-265986</guid>
		<description>More web performance tips (including using the DocumentFragment interface) can be found there:

http://www.slideshare.net/julien.lecomte/high-performance-ajax-applications

Cheers!</description>
		<content:encoded><![CDATA[<p>More web performance tips (including using the DocumentFragment interface) can be found there:</p>
<p><a href="http://www.slideshare.net/julien.lecomte/high-performance-ajax-applications" rel="nofollow">http://www.slideshare.net/julien.lecomte/high-performance-ajax-applications</a></p>
<p>Cheers!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

