<?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: Benchmark: DOM vs. innerHTML</title>
	<atom:link href="http://ajaxian.com/archives/benchmark-dom-vs-innerhtml/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/benchmark-dom-vs-innerhtml</link>
	<description>Cleaning up the web with Ajax</description>
	<lastBuildDate>Thu, 09 Feb 2012 06:55:33 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
	<item>
		<title>By: domguru</title>
		<link>http://ajaxian.com/archives/benchmark-dom-vs-innerhtml/comment-page-1#comment-250616</link>
		<dc:creator>domguru</dc:creator>
		<pubDate>Sat, 19 May 2007 08:23:31 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=1695#comment-250616</guid>
		<description>This test is a complete nonsense. why dont you guys append those DIV elements to the document and see which one is really faster. Speaking from experience, IE will be the clear winner if you appendChild right after createElement method. There is no browser out there which can beat Internet Explorer if you really know what you are doing.</description>
		<content:encoded><![CDATA[<p>This test is a complete nonsense. why dont you guys append those DIV elements to the document and see which one is really faster. Speaking from experience, IE will be the clear winner if you appendChild right after createElement method. There is no browser out there which can beat Internet Explorer if you really know what you are doing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DOM vs. innerHTML &#171; ì›ƒìœ¼ë©° ì‚¬ëŠ” ì„¸ìƒ</title>
		<link>http://ajaxian.com/archives/benchmark-dom-vs-innerhtml/comment-page-1#comment-221118</link>
		<dc:creator>DOM vs. innerHTML &#171; ì›ƒìœ¼ë©° ì‚¬ëŠ” ì„¸ìƒ</dc:creator>
		<pubDate>Fri, 01 Dec 2006 04:27:52 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=1695#comment-221118</guid>
		<description>[...] DOM vs. innerHTML   Published October 19th, 2006   Enter the Matrix       ì¶œì²˜: Ajaxian and code here [...]</description>
		<content:encoded><![CDATA[<p>[...] DOM vs. innerHTML   Published October 19th, 2006   Enter the Matrix       ì¶œì²˜: Ajaxian and code here [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Friedland</title>
		<link>http://ajaxian.com/archives/benchmark-dom-vs-innerhtml/comment-page-1#comment-154628</link>
		<dc:creator>David Friedland</dc:creator>
		<pubDate>Mon, 30 Oct 2006 22:57:44 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=1695#comment-154628</guid>
		<description>After searching for many hours on trying to find a way to dynamically populate an enormous drop down list (up to 14k items). Nothing beats innerHTML.  We&#039;re talking dollars and cents here.  It&#039;s not rocket science.  If innerHTML works in a fraction of a second and the DOM method takes 4 seconds, just do the math.  The client makes $x per minute. and if they lose 3.5 seconds per user per list change, they&#039;re not going to care how it&#039;s coded, they&#039;ll want innerHTML.  Welcome to the real world.  I just want an easier way to pop it into my elements where IE won&#039;t try to parse it. Any ideas?</description>
		<content:encoded><![CDATA[<p>After searching for many hours on trying to find a way to dynamically populate an enormous drop down list (up to 14k items). Nothing beats innerHTML.  We&#8217;re talking dollars and cents here.  It&#8217;s not rocket science.  If innerHTML works in a fraction of a second and the DOM method takes 4 seconds, just do the math.  The client makes $x per minute. and if they lose 3.5 seconds per user per list change, they&#8217;re not going to care how it&#8217;s coded, they&#8217;ll want innerHTML.  Welcome to the real world.  I just want an easier way to pop it into my elements where IE won&#8217;t try to parse it. Any ideas?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fdwflezcsk</title>
		<link>http://ajaxian.com/archives/benchmark-dom-vs-innerhtml/comment-page-1#comment-146148</link>
		<dc:creator>fdwflezcsk</dc:creator>
		<pubDate>Wed, 25 Oct 2006 07:37:57 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=1695#comment-146148</guid>
		<description>&lt;strong&gt;fwxrrjchu&lt;/strong&gt;

kmpkkruy wzngfdy qypnplfqru</description>
		<content:encoded><![CDATA[<p><strong>fwxrrjchu</strong></p>
<p>kmpkkruy wzngfdy qypnplfqru</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luis Ortiz</title>
		<link>http://ajaxian.com/archives/benchmark-dom-vs-innerhtml/comment-page-1#comment-137309</link>
		<dc:creator>Luis Ortiz</dc:creator>
		<pubDate>Thu, 19 Oct 2006 18:22:35 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=1695#comment-137309</guid>
		<description>Totally agree with Richard Kimber.  In practice, I have always used &lt;a href=&quot;http://www.quirksmode.org/dom/tests/docfrag.html&quot; title=&quot;Quirksmode Rules! thank you Peter-Paul Koch&quot; rel=&quot;nofollow&quot;&gt;document.createDocumentFragment()&lt;/a&gt; to ameliorate the performance problems with complex DOM manipulation.  At times though I have used innerHTML because its so simple (Chuck) but I always feel a little bit dirty for doing so - like fast food dinners.</description>
		<content:encoded><![CDATA[<p>Totally agree with Richard Kimber.  In practice, I have always used <a href="http://www.quirksmode.org/dom/tests/docfrag.html" title="Quirksmode Rules! thank you Peter-Paul Koch" rel="nofollow">document.createDocumentFragment()</a> to ameliorate the performance problems with complex DOM manipulation.  At times though I have used innerHTML because its so simple (Chuck) but I always feel a little bit dirty for doing so &#8211; like fast food dinners.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abe Pazos</title>
		<link>http://ajaxian.com/archives/benchmark-dom-vs-innerhtml/comment-page-1#comment-136917</link>
		<dc:creator>Abe Pazos</dc:creator>
		<pubDate>Thu, 19 Oct 2006 11:33:28 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=1695#comment-136917</guid>
		<description>About my post above, I asked Wladimir Palant, (main) author of Adblock Plus about the JavaScript performance and he told me this specific test creates lots of images, which Adblock Plus must check to see if they are ads or not, making it slower. It should not happen with typical JavaScript code.</description>
		<content:encoded><![CDATA[<p>About my post above, I asked Wladimir Palant, (main) author of Adblock Plus about the JavaScript performance and he told me this specific test creates lots of images, which Adblock Plus must check to see if they are ads or not, making it slower. It should not happen with typical JavaScript code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gleb</title>
		<link>http://ajaxian.com/archives/benchmark-dom-vs-innerhtml/comment-page-1#comment-136677</link>
		<dc:creator>Gleb</dc:creator>
		<pubDate>Thu, 19 Oct 2006 06:59:25 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=1695#comment-136677</guid>
		<description>Updated values from my benchmark:

MOZ

Result: node.innerHtml=... 397.0 404.0 406.0 255.9 413.0
Result: document.createElement(&#039;... = 114.0 120.0 119.0 124.6 151.0
Result: document.cloneNode(&#039;... = 122.0 115.0 120.0 122.3 150.0

IE 32 + AOL Toolbar

    
Result: node.innerHtml=... 101.0 89.0 85.0 95.0 90.0
Result: document.createElement(&#039;... =  30.5 30.0 29.5 29.0 28.0
Result: document.cloneNode(&#039;... =  40.0 38.4 38.0 36.0 35.0

IE 64

Result: node.innerHtml=... 160.0 147.0 118.0 90.0 57.1
Result: document.createElement(&#039;... =  34.4 32.0 29.6 35.0 40.4
Result: document.cloneNode(&#039;... =  37.4 36.4 35.0 32.5 29.0

Opera

Result: node.innerHtml=... 1901.0 941.0 1300.3 9.0 1919.0
Result: document.createElement(&#039;... = 320.0 327.8 330.7 336.0 331.0
Result: document.cloneNode(&#039;... = 344.0 348.0 360.0 347.0 350.0

Opera is still the fastest, but there is no big diffenece between createElement and cloneNode...</description>
		<content:encoded><![CDATA[<p>Updated values from my benchmark:</p>
<p>MOZ</p>
<p>Result: node.innerHtml=&#8230; 397.0 404.0 406.0 255.9 413.0<br />
Result: document.createElement(&#8216;&#8230; = 114.0 120.0 119.0 124.6 151.0<br />
Result: document.cloneNode(&#8216;&#8230; = 122.0 115.0 120.0 122.3 150.0</p>
<p>IE 32 + AOL Toolbar</p>
<p>Result: node.innerHtml=&#8230; 101.0 89.0 85.0 95.0 90.0<br />
Result: document.createElement(&#8216;&#8230; =  30.5 30.0 29.5 29.0 28.0<br />
Result: document.cloneNode(&#8216;&#8230; =  40.0 38.4 38.0 36.0 35.0</p>
<p>IE 64</p>
<p>Result: node.innerHtml=&#8230; 160.0 147.0 118.0 90.0 57.1<br />
Result: document.createElement(&#8216;&#8230; =  34.4 32.0 29.6 35.0 40.4<br />
Result: document.cloneNode(&#8216;&#8230; =  37.4 36.4 35.0 32.5 29.0</p>
<p>Opera</p>
<p>Result: node.innerHtml=&#8230; 1901.0 941.0 1300.3 9.0 1919.0<br />
Result: document.createElement(&#8216;&#8230; = 320.0 327.8 330.7 336.0 331.0<br />
Result: document.cloneNode(&#8216;&#8230; = 344.0 348.0 360.0 347.0 350.0</p>
<p>Opera is still the fastest, but there is no big diffenece between createElement and cloneNode&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gleb</title>
		<link>http://ajaxian.com/archives/benchmark-dom-vs-innerhtml/comment-page-1#comment-136574</link>
		<dc:creator>Gleb</dc:creator>
		<pubDate>Thu, 19 Oct 2006 05:28:22 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=1695#comment-136574</guid>
		<description>This code is based on my HTML2DOM converter used to create DHTML forms. So controlContainer is legacy :)</description>
		<content:encoded><![CDATA[<p>This code is based on my HTML2DOM converter used to create DHTML forms. So controlContainer is legacy :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://ajaxian.com/archives/benchmark-dom-vs-innerhtml/comment-page-1#comment-136063</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Wed, 18 Oct 2006 22:22:38 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=1695#comment-136063</guid>
		<description>Is there really much point to this?  Unless you&#039;re doing some incredibly unusual dynamic building of pages, you&#039;re typically just inserting a handful of elements in response to an event  and *either* approach is going to be fast enough.</description>
		<content:encoded><![CDATA[<p>Is there really much point to this?  Unless you&#8217;re doing some incredibly unusual dynamic building of pages, you&#8217;re typically just inserting a handful of elements in response to an event  and *either* approach is going to be fast enough.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chuck</title>
		<link>http://ajaxian.com/archives/benchmark-dom-vs-innerhtml/comment-page-1#comment-135679</link>
		<dc:creator>Chuck</dc:creator>
		<pubDate>Wed, 18 Oct 2006 20:11:32 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=1695#comment-135679</guid>
		<description>The simplification and convenience of innerHTML just can&#039;t be beat. If you&#039;re inserting content that fits a very rigid structure, you may not need it, but if you&#039;re creating functions with a wide degree of flexibility, manual DOM methods can be hell. 
You create a method that displays a confirmation message. Then you realize that you need to be able to display messages that occupy multiple paragraphs. Hmmm... Or even just throw in simple stuff like the need to include inline tags (&lt;em&gt;em&lt;/em&gt;, &lt;em&gt;strong&lt;/em&gt;, etc.). 
Sure, you can create a parsing system of your own, but there&#039;s no way you can possibly create one better than the compiled one built in to the browser and certainly nothing that can be implemented as easily as &lt;code&gt;foo.innerHTML=bar&lt;/code&gt;.</description>
		<content:encoded><![CDATA[<p>The simplification and convenience of innerHTML just can&#8217;t be beat. If you&#8217;re inserting content that fits a very rigid structure, you may not need it, but if you&#8217;re creating functions with a wide degree of flexibility, manual DOM methods can be hell.<br />
You create a method that displays a confirmation message. Then you realize that you need to be able to display messages that occupy multiple paragraphs. Hmmm&#8230; Or even just throw in simple stuff like the need to include inline tags (<em>em</em>, <em>strong</em>, etc.).<br />
Sure, you can create a parsing system of your own, but there&#8217;s no way you can possibly create one better than the compiled one built in to the browser and certainly nothing that can be implemented as easily as <code>foo.innerHTML=bar</code>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abe Pazos</title>
		<link>http://ajaxian.com/archives/benchmark-dom-vs-innerhtml/comment-page-1#comment-135510</link>
		<dc:creator>Abe Pazos</dc:creator>
		<pubDate>Wed, 18 Oct 2006 17:55:13 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=1695#comment-135510</guid>
		<description>It looks like &lt;b&gt;Adblock Plus&lt;/b&gt; makes the test results much worse:
&lt;strong&gt;FIREFOX 1.5.0.7 - NO Adblock&lt;/strong&gt;
. Inner HTML: 512 514 516 513
. document.createElement: 169 164 165 164
&lt;strong&gt;FIREFOX - Adblock Plus 0.7.1.2 disabled in interface&lt;/strong&gt;
. Inner HTML: 204 207 204 207
. document.createElement: 117 115 117 115
&lt;strong&gt;FIREFOX - Adblock Plus 0.7.1.2 Enabled&lt;/strong&gt;
. Inner HTML: 171 166 165 155
. document.createElement: 111 118 113 105
&lt;strong&gt;OPERA 9.0 beta&lt;/strong&gt;
. Inner HTML: 2800 2580 2635 2549
. document.createElement: 240 229 184 232
&lt;strong&gt;IE 6&lt;/strong&gt;
. Inner HTML: 317 269 247 227
. document.createElement: 98 80 72 68

Does it mean JavaScript executes 3 times slower with Adblock Plus installed on Firefox? Or maybe only certain operations?</description>
		<content:encoded><![CDATA[<p>It looks like <b>Adblock Plus</b> makes the test results much worse:<br />
<strong>FIREFOX 1.5.0.7 &#8211; NO Adblock</strong><br />
. Inner HTML: 512 514 516 513<br />
. document.createElement: 169 164 165 164<br />
<strong>FIREFOX &#8211; Adblock Plus 0.7.1.2 disabled in interface</strong><br />
. Inner HTML: 204 207 204 207<br />
. document.createElement: 117 115 117 115<br />
<strong>FIREFOX &#8211; Adblock Plus 0.7.1.2 Enabled</strong><br />
. Inner HTML: 171 166 165 155<br />
. document.createElement: 111 118 113 105<br />
<strong>OPERA 9.0 beta</strong><br />
. Inner HTML: 2800 2580 2635 2549<br />
. document.createElement: 240 229 184 232<br />
<strong>IE 6</strong><br />
. Inner HTML: 317 269 247 227<br />
. document.createElement: 98 80 72 68</p>
<p>Does it mean JavaScript executes 3 times slower with Adblock Plus installed on Firefox? Or maybe only certain operations?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ndp</title>
		<link>http://ajaxian.com/archives/benchmark-dom-vs-innerhtml/comment-page-1#comment-135430</link>
		<dc:creator>ndp</dc:creator>
		<pubDate>Wed, 18 Oct 2006 16:24:17 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=1695#comment-135430</guid>
		<description>Speed is usually not the critical factor for code-- at least 90 - 95% of it-- so I can&#039;t see how you can make architectural decisions solely on this benchmark, whether it&#039;s valid or not.

If I&#039;m reading it right, the slowest code only takes 1/60th of a second, and has no affect on my server, where the bottlenecks usually are. 

You can argue that this is a very simple page, and real pages are more complicated. In reality, though, the page complexity is bounded by what a user can comprehend, so it&#039;s not going to be more than an order of magnitude more complicated. So for the most complicated reasonable page, we&#039;re talking 1/6th of a second vs. 1/20th of a second (FF), and less of a difference on IE. These both seem within the realm of a &quot;responsive&quot; app.</description>
		<content:encoded><![CDATA[<p>Speed is usually not the critical factor for code&#8211; at least 90 &#8211; 95% of it&#8211; so I can&#8217;t see how you can make architectural decisions solely on this benchmark, whether it&#8217;s valid or not.</p>
<p>If I&#8217;m reading it right, the slowest code only takes 1/60th of a second, and has no affect on my server, where the bottlenecks usually are. </p>
<p>You can argue that this is a very simple page, and real pages are more complicated. In reality, though, the page complexity is bounded by what a user can comprehend, so it&#8217;s not going to be more than an order of magnitude more complicated. So for the most complicated reasonable page, we&#8217;re talking 1/6th of a second vs. 1/20th of a second (FF), and less of a difference on IE. These both seem within the realm of a &#8220;responsive&#8221; app.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Isaiah</title>
		<link>http://ajaxian.com/archives/benchmark-dom-vs-innerhtml/comment-page-1#comment-135403</link>
		<dc:creator>Isaiah</dc:creator>
		<pubDate>Wed, 18 Oct 2006 16:01:17 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=1695#comment-135403</guid>
		<description>Not all DOM selection techniques are created equal.  Here&#039;s a LIVE benchmark that you can run yourself to see how the various Javascript frameworks handle it.

http://wiki.mootools.net/benchmark

Isaiah</description>
		<content:encoded><![CDATA[<p>Not all DOM selection techniques are created equal.  Here&#8217;s a LIVE benchmark that you can run yourself to see how the various Javascript frameworks handle it.</p>
<p><a href="http://wiki.mootools.net/benchmark" rel="nofollow">http://wiki.mootools.net/benchmark</a></p>
<p>Isaiah</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick Corcoran</title>
		<link>http://ajaxian.com/archives/benchmark-dom-vs-innerhtml/comment-page-1#comment-135393</link>
		<dc:creator>Patrick Corcoran</dc:creator>
		<pubDate>Wed, 18 Oct 2006 15:53:57 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=1695#comment-135393</guid>
		<description>Why is he adding all those custom node attributes called &quot;controlContainer&quot;?  

They are not part of any spec, the browser doesn&#039;t need them, and they can only be slowing down the generation of his DOM creation.</description>
		<content:encoded><![CDATA[<p>Why is he adding all those custom node attributes called &#8220;controlContainer&#8221;?  </p>
<p>They are not part of any spec, the browser doesn&#8217;t need them, and they can only be slowing down the generation of his DOM creation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Henrik Gemal</title>
		<link>http://ajaxian.com/archives/benchmark-dom-vs-innerhtml/comment-page-1#comment-135380</link>
		<dc:creator>Henrik Gemal</dc:creator>
		<pubDate>Wed, 18 Oct 2006 15:43:47 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=1695#comment-135380</guid>
		<description>Using latest nightly Mozilla Firefox builds Im getting numbers like:
test1: 133
test2: 129

So next gen Firefox will be much faster than todays</description>
		<content:encoded><![CDATA[<p>Using latest nightly Mozilla Firefox builds Im getting numbers like:<br />
test1: 133<br />
test2: 129</p>
<p>So next gen Firefox will be much faster than todays</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Richard Kimber</title>
		<link>http://ajaxian.com/archives/benchmark-dom-vs-innerhtml/comment-page-1#comment-135371</link>
		<dc:creator>Richard Kimber</dc:creator>
		<pubDate>Wed, 18 Oct 2006 15:34:44 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=1695#comment-135371</guid>
		<description>It seems to me that both methods have there advantages and disadvantages. I took it for granted that the innerHTML option would be a lot faster (to write as well, in some cases), however DOM offers more structured control of individual elements. I don&#039;t really see what all the fuss is about.</description>
		<content:encoded><![CDATA[<p>It seems to me that both methods have there advantages and disadvantages. I took it for granted that the innerHTML option would be a lot faster (to write as well, in some cases), however DOM offers more structured control of individual elements. I don&#8217;t really see what all the fuss is about.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Kahn</title>
		<link>http://ajaxian.com/archives/benchmark-dom-vs-innerhtml/comment-page-1#comment-135365</link>
		<dc:creator>Mark Kahn</dc:creator>
		<pubDate>Wed, 18 Oct 2006 15:29:45 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=1695#comment-135365</guid>
		<description>I agree with VoR in that this is often more about ease of use than it is about speed.  To me, having direct references to specific DOM nodes is often a necessity.  I&#039;d be interested in seeing this same benchmark, but with this instead:

x.innerHTML = &#039;....&#039;;
var node1 = document.getElementById(&#039;node1&#039;);
var node2 = document.getElementById(&#039;node2&#039;);
...etc

so that you can get actual references to all the nodes you just created.

Granted, you often don&#039;t NEED references to every single node, but the code isn&#039;t doing the same thing otherwise!</description>
		<content:encoded><![CDATA[<p>I agree with VoR in that this is often more about ease of use than it is about speed.  To me, having direct references to specific DOM nodes is often a necessity.  I&#8217;d be interested in seeing this same benchmark, but with this instead:</p>
<p>x.innerHTML = &#8216;&#8230;.&#8217;;<br />
var node1 = document.getElementById(&#8216;node1&#8242;);<br />
var node2 = document.getElementById(&#8216;node2&#8242;);<br />
&#8230;etc</p>
<p>so that you can get actual references to all the nodes you just created.</p>
<p>Granted, you often don&#8217;t NEED references to every single node, but the code isn&#8217;t doing the same thing otherwise!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Herron</title>
		<link>http://ajaxian.com/archives/benchmark-dom-vs-innerhtml/comment-page-1#comment-135317</link>
		<dc:creator>Andrew Herron</dc:creator>
		<pubDate>Wed, 18 Oct 2006 15:09:02 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=1695#comment-135317</guid>
		<description>The only time I use innerHTML is to pull the data inside an element, that way I don&#039;t have to deal with FF&#039;s textNodes.</description>
		<content:encoded><![CDATA[<p>The only time I use innerHTML is to pull the data inside an element, that way I don&#8217;t have to deal with FF&#8217;s textNodes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Schiller</title>
		<link>http://ajaxian.com/archives/benchmark-dom-vs-innerhtml/comment-page-1#comment-135288</link>
		<dc:creator>Scott Schiller</dc:creator>
		<pubDate>Wed, 18 Oct 2006 14:58:41 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=1695#comment-135288</guid>
		<description>I wouldn&#039;t consider this to be a valid comparison, given innerHTML modifies the DOM once with a large string, whereas using createNode() and so on, 95 nodes are made; of course the &quot;standard&quot; method will be slower with that approach! :) .. Were one cloneNode() and one append to be used, I would expect you&#039;d see similar results. When the browser has to individually create 95 nodes as with this &quot;test&quot;, there should be no question as to which method will be faster.

Secondly, I&#039;m of the opinion that it is poor practice to be creating mass amounts of markup using Javascript. Instead, one should use a &quot;templating&quot; approach - have your HTML where it should belong to begin with (in the document as HTML), clone it once and append to a target once (or clone many times to a document fragment, and append that fragment once) as opposed to creating it all in Javascript.

With the new Yahoo! Photos, the cloning approach was taken to creating mass amounts of photo items using Javascript, and it has worked quite well. It is slightly slower than innerHTMLing a super-large string out, but  I&#039;ve found the standard DOM-based approach is easier to work with and maintain. If you don&#039;t do multiple (or many) writes to the DOM (ideally just one like innerHTML), your performance should be quite comparable.</description>
		<content:encoded><![CDATA[<p>I wouldn&#8217;t consider this to be a valid comparison, given innerHTML modifies the DOM once with a large string, whereas using createNode() and so on, 95 nodes are made; of course the &#8220;standard&#8221; method will be slower with that approach! :) .. Were one cloneNode() and one append to be used, I would expect you&#8217;d see similar results. When the browser has to individually create 95 nodes as with this &#8220;test&#8221;, there should be no question as to which method will be faster.</p>
<p>Secondly, I&#8217;m of the opinion that it is poor practice to be creating mass amounts of markup using Javascript. Instead, one should use a &#8220;templating&#8221; approach &#8211; have your HTML where it should belong to begin with (in the document as HTML), clone it once and append to a target once (or clone many times to a document fragment, and append that fragment once) as opposed to creating it all in Javascript.</p>
<p>With the new Yahoo! Photos, the cloning approach was taken to creating mass amounts of photo items using Javascript, and it has worked quite well. It is slightly slower than innerHTMLing a super-large string out, but  I&#8217;ve found the standard DOM-based approach is easier to work with and maintain. If you don&#8217;t do multiple (or many) writes to the DOM (ideally just one like innerHTML), your performance should be quite comparable.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gleb</title>
		<link>http://ajaxian.com/archives/benchmark-dom-vs-innerhtml/comment-page-1#comment-135253</link>
		<dc:creator>Gleb</dc:creator>
		<pubDate>Wed, 18 Oct 2006 14:53:25 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=1695#comment-135253</guid>
		<description>Hi, all!

Really the test was not about DOM vs. innerHTML, so it is valid. I think DOM can be optimized, but whole idea of this benchmark was to measure javascript+dhtml performance, not dhtml technique performance ;-)

So, Mario, you think cloning will be much faster? Can you give me a sample how I can use it on my JavaScript?</description>
		<content:encoded><![CDATA[<p>Hi, all!</p>
<p>Really the test was not about DOM vs. innerHTML, so it is valid. I think DOM can be optimized, but whole idea of this benchmark was to measure javascript+dhtml performance, not dhtml technique performance ;-)</p>
<p>So, Mario, you think cloning will be much faster? Can you give me a sample how I can use it on my JavaScript?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

