<?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: Javascript HTML Construction Benchmark</title>
	<atom:link href="http://ajaxian.com/archives/javascript-html-construction-benchmark/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/javascript-html-construction-benchmark</link>
	<description>Cleaning up the web with Ajax</description>
	<lastBuildDate>Sun, 14 Mar 2010 15:41:39 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: PeterMichaux</title>
		<link>http://ajaxian.com/archives/javascript-html-construction-benchmark/comment-page-1#comment-264668</link>
		<dc:creator>PeterMichaux</dc:creator>
		<pubDate>Sat, 07 Jun 2008 05:23:12 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-html-construction-benchmark#comment-264668</guid>
		<description>I was building the body of a big table that had roughly 15000 elements. I tried DOM methods first and it was completely unacceptable. Many seconds to do the job. Using innerHTML was very acceptable at less than a second.</description>
		<content:encoded><![CDATA[<p>I was building the body of a big table that had roughly 15000 elements. I tried DOM methods first and it was completely unacceptable. Many seconds to do the job. Using innerHTML was very acceptable at less than a second.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: matanlurey</title>
		<link>http://ajaxian.com/archives/javascript-html-construction-benchmark/comment-page-1#comment-264653</link>
		<dc:creator>matanlurey</dc:creator>
		<pubDate>Fri, 06 Jun 2008 22:18:47 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-html-construction-benchmark#comment-264653</guid>
		<description>@marijn:

On XML DOM: Yes, you can insert nodes from XML into HTML. Obviously not all XML elements exist in XHTML, you would have to either write a parser/converter in Javascript, or use XSLT (a better choice, obviously). The cross-browser API is not consistent, but there is a way of doing it (natively) in almost every browser.

On Parsing HTML: It most likely has something to do with innerHTML being more like the initial document loading. You can read more on Steven Leviathan&#039;s blog: &lt;a href=&quot;http://blog.stevenlevithan.com/archives/faster-than-innerhtml&quot; rel=&quot;nofollow&quot;&gt;When innerHTML isnâ€™t Fast Enough&lt;/a&gt; and his solutions for quick rendering using a combination of DOM, innerHTML, and Regular Expressions.</description>
		<content:encoded><![CDATA[<p>@marijn:</p>
<p>On XML DOM: Yes, you can insert nodes from XML into HTML. Obviously not all XML elements exist in XHTML, you would have to either write a parser/converter in Javascript, or use XSLT (a better choice, obviously). The cross-browser API is not consistent, but there is a way of doing it (natively) in almost every browser.</p>
<p>On Parsing HTML: It most likely has something to do with innerHTML being more like the initial document loading. You can read more on Steven Leviathan&#8217;s blog: <a href="http://blog.stevenlevithan.com/archives/faster-than-innerhtml" rel="nofollow">When innerHTML isnâ€™t Fast Enough</a> and his solutions for quick rendering using a combination of DOM, innerHTML, and Regular Expressions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: marijn</title>
		<link>http://ajaxian.com/archives/javascript-html-construction-benchmark/comment-page-1#comment-264548</link>
		<dc:creator>marijn</dc:creator>
		<pubDate>Fri, 06 Jun 2008 20:15:23 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-html-construction-benchmark#comment-264548</guid>
		<description>(Also, can anyone *explain* these results? It would seem that parsing HTML is a whole lot more work than manipulating nicely structured DOM nodes.)</description>
		<content:encoded><![CDATA[<p>(Also, can anyone *explain* these results? It would seem that parsing HTML is a whole lot more work than manipulating nicely structured DOM nodes.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: marijn</title>
		<link>http://ajaxian.com/archives/javascript-html-construction-benchmark/comment-page-1#comment-264524</link>
		<dc:creator>marijn</dc:creator>
		<pubDate>Fri, 06 Jun 2008 17:40:41 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-html-construction-benchmark#comment-264524</guid>
		<description>So is using the XML DOM model to generate page fragments workable? I guess you&#039;d have make your whole document XHTML. Can inserting nodes from an XML document into the page be done in Internet Explorer?</description>
		<content:encoded><![CDATA[<p>So is using the XML DOM model to generate page fragments workable? I guess you&#8217;d have make your whole document XHTML. Can inserting nodes from an XML document into the page be done in Internet Explorer?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: matanlurey</title>
		<link>http://ajaxian.com/archives/javascript-html-construction-benchmark/comment-page-1#comment-264523</link>
		<dc:creator>matanlurey</dc:creator>
		<pubDate>Fri, 06 Jun 2008 17:31:03 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-html-construction-benchmark#comment-264523</guid>
		<description>On the XML Dom: Probably because XML DOM isn&#039;t being drawn to the screen as controls, it resides entirely in memory, and no checks are needed for security/functionality reasons (i.e., if its an iframe tag, connect it to X url)</description>
		<content:encoded><![CDATA[<p>On the XML Dom: Probably because XML DOM isn&#8217;t being drawn to the screen as controls, it resides entirely in memory, and no checks are needed for security/functionality reasons (i.e., if its an iframe tag, connect it to X url)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Grauw</title>
		<link>http://ajaxian.com/archives/javascript-html-construction-benchmark/comment-page-1#comment-264499</link>
		<dc:creator>Grauw</dc:creator>
		<pubDate>Fri, 06 Jun 2008 13:21:28 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-html-construction-benchmark#comment-264499</guid>
		<description>You can conclude from the article that XML DOM methods are just as fast (or rather, even faster) than innerHTML. HTML DOM methods are not.</description>
		<content:encoded><![CDATA[<p>You can conclude from the article that XML DOM methods are just as fast (or rather, even faster) than innerHTML. HTML DOM methods are not.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jordan</title>
		<link>http://ajaxian.com/archives/javascript-html-construction-benchmark/comment-page-1#comment-264486</link>
		<dc:creator>Jordan</dc:creator>
		<pubDate>Fri, 06 Jun 2008 07:06:31 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-html-construction-benchmark#comment-264486</guid>
		<description>I don&#039;t see it being claimed anywhere in the article that &lt;i&gt;&quot;DOM methods are just as fast!&quot;&lt;/i&gt;. Did I miss anything?</description>
		<content:encoded><![CDATA[<p>I don&#8217;t see it being claimed anywhere in the article that <i>&#8220;DOM methods are just as fast!&#8221;</i>. Did I miss anything?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Grauw</title>
		<link>http://ajaxian.com/archives/javascript-html-construction-benchmark/comment-page-1#comment-264482</link>
		<dc:creator>Grauw</dc:creator>
		<pubDate>Thu, 05 Jun 2008 22:19:05 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-html-construction-benchmark#comment-264482</guid>
		<description>@MaratDenenberg: No, in the worst case it would be more like 15 times slower, rather :). The â€˜100â€™ index is the performance of the XML DOM, innerHTML has a â€˜147â€™ score. Actually, I misread it myself (with divs, innerHTML is up to 3Â½ times faster, not 5, as I said in my earlier comment), so Iâ€™m not exactly sure whether including that index really made the numbers clearer -_-;;. Oh well.

You could say however that in the worst case, using the XML DOM is 22 times faster than the HTML DOM. Hey! ^_^</description>
		<content:encoded><![CDATA[<p>@MaratDenenberg: No, in the worst case it would be more like 15 times slower, rather :). The â€˜100â€™ index is the performance of the XML DOM, innerHTML has a â€˜147â€™ score. Actually, I misread it myself (with divs, innerHTML is up to 3Â½ times faster, not 5, as I said in my earlier comment), so Iâ€™m not exactly sure whether including that index really made the numbers clearer -_-;;. Oh well.</p>
<p>You could say however that in the worst case, using the XML DOM is 22 times faster than the HTML DOM. Hey! ^_^</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: polterguy</title>
		<link>http://ajaxian.com/archives/javascript-html-construction-benchmark/comment-page-1#comment-264481</link>
		<dc:creator>polterguy</dc:creator>
		<pubDate>Thu, 05 Jun 2008 21:33:26 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-html-construction-benchmark#comment-264481</guid>
		<description>Puuuhhh... Good thing we&#039;re using innerHTML ;)</description>
		<content:encoded><![CDATA[<p>Puuuhhh&#8230; Good thing we&#8217;re using innerHTML ;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymouse</title>
		<link>http://ajaxian.com/archives/javascript-html-construction-benchmark/comment-page-1#comment-264478</link>
		<dc:creator>Anonymouse</dc:creator>
		<pubDate>Thu, 05 Jun 2008 20:29:58 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-html-construction-benchmark#comment-264478</guid>
		<description>matanlurey: Maybe javasscript isn&#039;t slow compared to other &lt;i&gt;interpreted&lt;/i&gt; languages, but it is exactly because it is an interpreted language that it is a slow one. Ten milliseconds might not seem much, but it is 10ms the browser could have been doing something else. If you were talking about nanoseconds I&#039;d have to agree, but almost everything we seek to accomplish in javascript will take in the order of several ms. Research has shown a delay of even 100ms to have a significant effect in customer satisfaction.</description>
		<content:encoded><![CDATA[<p>matanlurey: Maybe javasscript isn&#8217;t slow compared to other <i>interpreted</i> languages, but it is exactly because it is an interpreted language that it is a slow one. Ten milliseconds might not seem much, but it is 10ms the browser could have been doing something else. If you were talking about nanoseconds I&#8217;d have to agree, but almost everything we seek to accomplish in javascript will take in the order of several ms. Research has shown a delay of even 100ms to have a significant effect in customer satisfaction.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: KitSunde</title>
		<link>http://ajaxian.com/archives/javascript-html-construction-benchmark/comment-page-1#comment-264477</link>
		<dc:creator>KitSunde</dc:creator>
		<pubDate>Thu, 05 Jun 2008 20:28:43 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-html-construction-benchmark#comment-264477</guid>
		<description>I&#039;m not sure what to make of those numbers yet. I would have preferred a working test case to play with instead of having to fix his incomplete code. Either way I appreciate the effort.</description>
		<content:encoded><![CDATA[<p>I&#8217;m not sure what to make of those numbers yet. I would have preferred a working test case to play with instead of having to fix his incomplete code. Either way I appreciate the effort.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hans Schmucker</title>
		<link>http://ajaxian.com/archives/javascript-html-construction-benchmark/comment-page-1#comment-264476</link>
		<dc:creator>Hans Schmucker</dc:creator>
		<pubDate>Thu, 05 Jun 2008 20:25:45 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-html-construction-benchmark#comment-264476</guid>
		<description>If I may throw in a bigger problem with innerHTML... text simply cannot transport all the information I need. In a typical project, I generate the DOM tree using DOM methods, because otherwise, I&#039;d have to first generate the tree using innerHTML, then find the nodes that have non-text values attached to them using getElement(s)ById/Name/Class, then attach the values to them. This seems pretty absurd by my standards and also rather slow, because I have to go through the tree again and again and again.

My personal way of doing things is to generate them from anonymous objects like this. Every elements is represented as a string (for textnodes) or an array (for normal nodes). The arrays can contain 3 types of data, namely a string for the tag, an object for properties and an array for childnodes. That way, I can sneak in any kind of data I want, not just strings, meaning that I get references instead of duplicates, bringing down overall memory usage. Also, since Javascript is a lot less forgiving than the HTML parser, I&#039;m much less likely to run into code that &quot;sort-of works&quot;, but is actually broken because I&#039;ve forgotten a bracket.

document.body.appendChild(JSON2HTML(
        [&quot;div&quot;,{ className:&quot;mainContent&quot; },[
                [&quot;h1&quot;,[     &quot;JSON2HTML&quot;     ]],
                [&quot;div&quot;,[     &quot;This is just a very simple demo&quot;     ]],
                [&quot;div&quot;,[
                        [&quot;ul&quot;,[
                                [&quot;li&quot;,{ style:{font-weight:&quot;bold&quot;} },[     &quot;It&#039;s easy&quot;     ]],
                                [&quot;li&quot;,[     &quot;It&#039;s beautiful&quot;     ]],
                                [&quot;li&quot;,[     &quot;It works&quot;     ]],
                        ]]
                ]],
        ]]
));</description>
		<content:encoded><![CDATA[<p>If I may throw in a bigger problem with innerHTML&#8230; text simply cannot transport all the information I need. In a typical project, I generate the DOM tree using DOM methods, because otherwise, I&#8217;d have to first generate the tree using innerHTML, then find the nodes that have non-text values attached to them using getElement(s)ById/Name/Class, then attach the values to them. This seems pretty absurd by my standards and also rather slow, because I have to go through the tree again and again and again.</p>
<p>My personal way of doing things is to generate them from anonymous objects like this. Every elements is represented as a string (for textnodes) or an array (for normal nodes). The arrays can contain 3 types of data, namely a string for the tag, an object for properties and an array for childnodes. That way, I can sneak in any kind of data I want, not just strings, meaning that I get references instead of duplicates, bringing down overall memory usage. Also, since Javascript is a lot less forgiving than the HTML parser, I&#8217;m much less likely to run into code that &#8220;sort-of works&#8221;, but is actually broken because I&#8217;ve forgotten a bracket.</p>
<p>document.body.appendChild(JSON2HTML(<br />
        ["div",{ className:"mainContent" },[<br />
                ["h1",[     "JSON2HTML"     ]],<br />
                ["div",[     "This is just a very simple demo"     ]],<br />
                ["div",[<br />
                        ["ul",[<br />
                                ["li",{ style:{font-weight:"bold"} },[     "It's easy"     ]],<br />
                                ["li",[     "It's beautiful"     ]],<br />
                                ["li",[     "It works"     ]],<br />
                        ]]<br />
                ]],<br />
        ]]<br />
));</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SteveBrewer</title>
		<link>http://ajaxian.com/archives/javascript-html-construction-benchmark/comment-page-1#comment-264475</link>
		<dc:creator>SteveBrewer</dc:creator>
		<pubDate>Thu, 05 Jun 2008 20:22:53 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-html-construction-benchmark#comment-264475</guid>
		<description>Your development workflow also makes a difference here - I typically build an html prototype and will be writing javascript to construct some piece of it - an innerHTML approach is a lot more straight forward (copy, past, small macro gets me 90% there).

Also, when tweaking / changing / debugging the layout, an innerHTML approach typically provides a more direct / obvious path between what&#039;s in your code and what&#039;s in the browser.

Also, can we just drop the &quot;correct&quot; arguments?  Both approaches are fully supported by the browser vendors - they are both valid.</description>
		<content:encoded><![CDATA[<p>Your development workflow also makes a difference here &#8211; I typically build an html prototype and will be writing javascript to construct some piece of it &#8211; an innerHTML approach is a lot more straight forward (copy, past, small macro gets me 90% there).</p>
<p>Also, when tweaking / changing / debugging the layout, an innerHTML approach typically provides a more direct / obvious path between what&#8217;s in your code and what&#8217;s in the browser.</p>
<p>Also, can we just drop the &#8220;correct&#8221; arguments?  Both approaches are fully supported by the browser vendors &#8211; they are both valid.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Grauw</title>
		<link>http://ajaxian.com/archives/javascript-html-construction-benchmark/comment-page-1#comment-264474</link>
		<dc:creator>Grauw</dc:creator>
		<pubDate>Thu, 05 Jun 2008 20:12:24 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-html-construction-benchmark#comment-264474</guid>
		<description>(continued, comment script seems to do string processing and break on the less than sign ;p)

â€¦less than sign or ampersand to script insertion vulnerabilities). So knowing that when working with divs in HTML, the DOM is only up to about 5 times slower (not 35), is very useful information.

Also these tests show that the DOM itself is not inherently slow; the XML DOM performance shows otherwise. Apparantly however the browsers have tacked some other stuff onto the DOM methods which makes it slow, and there is definitely room for improvements. Actually, if you look at the test results on QuirksMode, you can see that between IE 5.5 and IE 6, Microsoft did something that made performance decrease dramatically.

@digitalIchi: Hmm, I would think it would be faster. I will keep it in mind if Iâ€™m doing more testing in the future.

@matanlurey: I agree completely :).

~Grauw</description>
		<content:encoded><![CDATA[<p>(continued, comment script seems to do string processing and break on the less than sign ;p)</p>
<p>â€¦less than sign or ampersand to script insertion vulnerabilities). So knowing that when working with divs in HTML, the DOM is only up to about 5 times slower (not 35), is very useful information.</p>
<p>Also these tests show that the DOM itself is not inherently slow; the XML DOM performance shows otherwise. Apparantly however the browsers have tacked some other stuff onto the DOM methods which makes it slow, and there is definitely room for improvements. Actually, if you look at the test results on QuirksMode, you can see that between IE 5.5 and IE 6, Microsoft did something that made performance decrease dramatically.</p>
<p>@digitalIchi: Hmm, I would think it would be faster. I will keep it in mind if Iâ€™m doing more testing in the future.</p>
<p>@matanlurey: I agree completely :).</p>
<p>~Grauw</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Grauw</title>
		<link>http://ajaxian.com/archives/javascript-html-construction-benchmark/comment-page-1#comment-264473</link>
		<dc:creator>Grauw</dc:creator>
		<pubDate>Thu, 05 Jun 2008 20:10:50 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-html-construction-benchmark#comment-264473</guid>
		<description>@shawn: â€œstill sprinkling their code with if (document.all)â€

Itâ€™s a quick browser check that works for the two browsers that I tested here. Are you really going to base your opinion on that? I am providing the code fragments just to illustrate what changes I made to the original test.

Either way, as I wrote, originally I constructed an XML document and compared that with string building, and the performance differences were negligible, so the QuirksModeâ€™s results made me wonder. I wrote down my findings. You can appreciate it if you wish, or not.

Personally, 50% of the time I am working with XML documents, so having some numbers to base my code practices on is very relevant to programming good applications. I am really convinced that string building is hard to manage, and that by using the DOM you can avoid a lot of bugs that would occur otherwise; with XML such bugs are especially harmful, but also in HTML it can result in nasty hard-to-find issues (ranging from missing parts after a </description>
		<content:encoded><![CDATA[<p>@shawn: â€œstill sprinkling their code with if (document.all)â€</p>
<p>Itâ€™s a quick browser check that works for the two browsers that I tested here. Are you really going to base your opinion on that? I am providing the code fragments just to illustrate what changes I made to the original test.</p>
<p>Either way, as I wrote, originally I constructed an XML document and compared that with string building, and the performance differences were negligible, so the QuirksModeâ€™s results made me wonder. I wrote down my findings. You can appreciate it if you wish, or not.</p>
<p>Personally, 50% of the time I am working with XML documents, so having some numbers to base my code practices on is very relevant to programming good applications. I am really convinced that string building is hard to manage, and that by using the DOM you can avoid a lot of bugs that would occur otherwise; with XML such bugs are especially harmful, but also in HTML it can result in nasty hard-to-find issues (ranging from missing parts after a</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eyelidlessness</title>
		<link>http://ajaxian.com/archives/javascript-html-construction-benchmark/comment-page-1#comment-264472</link>
		<dc:creator>eyelidlessness</dc:creator>
		<pubDate>Thu, 05 Jun 2008 20:10:02 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-html-construction-benchmark#comment-264472</guid>
		<description>&quot;Letâ€™s face it, nobody think in DOM methods, they think in html first&quot;
.
Well, I find HTML (and XML) to almost invariably be a senseless and untrustworthy string of nonsense, and while the DOM &lt;em&gt;syntax&lt;/em&gt; sucks, the concept is a lot more coherent in terms of constructing a data hierarchy. I really like Prototype&#039;s DOM builder for that reason:
.
new Element(&#039;tagName&#039;, { attr: value });
.
And with the exception of constructing large, complex tables from a data set, I&#039;ll choose that method despite the minor performance hit. For the vast, vast majority of cases, users will be unable to notice the latency.</description>
		<content:encoded><![CDATA[<p>&#8220;Letâ€™s face it, nobody think in DOM methods, they think in html first&#8221;<br />
.<br />
Well, I find HTML (and XML) to almost invariably be a senseless and untrustworthy string of nonsense, and while the DOM <em>syntax</em> sucks, the concept is a lot more coherent in terms of constructing a data hierarchy. I really like Prototype&#8217;s DOM builder for that reason:<br />
.<br />
new Element(&#8217;tagName&#8217;, { attr: value });<br />
.<br />
And with the exception of constructing large, complex tables from a data set, I&#8217;ll choose that method despite the minor performance hit. For the vast, vast majority of cases, users will be unable to notice the latency.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: genericallyloud</title>
		<link>http://ajaxian.com/archives/javascript-html-construction-benchmark/comment-page-1#comment-264471</link>
		<dc:creator>genericallyloud</dc:creator>
		<pubDate>Thu, 05 Jun 2008 19:44:09 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-html-construction-benchmark#comment-264471</guid>
		<description>In regards to code clarity, as long as you aren&#039;t writing your html code to insert in handwritten javascript string concatenation, innerHtml is much much much nicer than DOM methods. Let&#039;s face it, nobody think in DOM methods, they think in html first, then use DOM methods to get it done. There are many ways to generate the html to insert using innerHTML. It could be generated server side using standard means or even clientside with something like &lt;a href=&quot;http://code.google.com/p/trimpath/wiki/JavaScriptTemplates&quot; rel=&quot;nofollow&quot;&gt;Trimpath templates&lt;/a&gt;. For a current project I&#039;m doing, I created an xml based templating language that gets compiled into javascript code to be executed on the client side. It ensures valid html with really nice code clarity and the speed of innerHtml.

Like everything else complicated, it depends.</description>
		<content:encoded><![CDATA[<p>In regards to code clarity, as long as you aren&#8217;t writing your html code to insert in handwritten javascript string concatenation, innerHtml is much much much nicer than DOM methods. Let&#8217;s face it, nobody think in DOM methods, they think in html first, then use DOM methods to get it done. There are many ways to generate the html to insert using innerHTML. It could be generated server side using standard means or even clientside with something like <a href="http://code.google.com/p/trimpath/wiki/JavaScriptTemplates" rel="nofollow">Trimpath templates</a>. For a current project I&#8217;m doing, I created an xml based templating language that gets compiled into javascript code to be executed on the client side. It ensures valid html with really nice code clarity and the speed of innerHtml.</p>
<p>Like everything else complicated, it depends.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Dupont</title>
		<link>http://ajaxian.com/archives/javascript-html-construction-benchmark/comment-page-1#comment-264469</link>
		<dc:creator>Andrew Dupont</dc:creator>
		<pubDate>Thu, 05 Jun 2008 19:02:01 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-html-construction-benchmark#comment-264469</guid>
		<description>His thesis is that innerHTML is very fast when compared to the HTML DOM, as we already knew â€” but that a third approach (using the XML DOM) is ever-so-slightly faster than innerHTML.

Great to hear, but this isn&#039;t a rebuttal to the conventional wisdom â€”Â it&#039;s a pedantic clarification at best.</description>
		<content:encoded><![CDATA[<p>His thesis is that innerHTML is very fast when compared to the HTML DOM, as we already knew â€” but that a third approach (using the XML DOM) is ever-so-slightly faster than innerHTML.</p>
<p>Great to hear, but this isn&#8217;t a rebuttal to the conventional wisdom â€”Â it&#8217;s a pedantic clarification at best.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: matanlurey</title>
		<link>http://ajaxian.com/archives/javascript-html-construction-benchmark/comment-page-1#comment-264465</link>
		<dc:creator>matanlurey</dc:creator>
		<pubDate>Thu, 05 Jun 2008 18:43:53 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-html-construction-benchmark#comment-264465</guid>
		<description>@Anonymouse:

JavaScript is &lt;strong&gt;not&lt;/strong&gt; inherently slow; if you have used Spider Monkey (or better yet, Rhino) in a standalone or plugin environment it actually competes quite well with other interpreted languages. An example is &lt;a href=&quot;http://www.aptana.com/jaxer&quot; rel=&quot;nofollow&quot;&gt;Jaxer&lt;/a&gt;, the JavaScript http server.

The main reason for &quot;slowness&quot; is the browser - it&#039;s security sandbox and of course, the DOM.

Obviously if you &lt;strong&gt;need&lt;/strong&gt; to create a dynamic 50x50 table (and can&#039;t use XML/XSLT for some design reason), the 50ms innerHTML method is a better choice than the 1000ms pure-DOM method. You can&#039;t have a user waiting a second or more.

However, when creating only a handful of DOM elements (say even 5x5), the difference in speed is negligible (the user won&#039;t notice a 10ms difference) - the opportunities/features/standards of DOM node creation is a better choice.</description>
		<content:encoded><![CDATA[<p>@Anonymouse:</p>
<p>JavaScript is <strong>not</strong> inherently slow; if you have used Spider Monkey (or better yet, Rhino) in a standalone or plugin environment it actually competes quite well with other interpreted languages. An example is <a href="http://www.aptana.com/jaxer" rel="nofollow">Jaxer</a>, the JavaScript http server.</p>
<p>The main reason for &#8220;slowness&#8221; is the browser &#8211; it&#8217;s security sandbox and of course, the DOM.</p>
<p>Obviously if you <strong>need</strong> to create a dynamic 50&#215;50 table (and can&#8217;t use XML/XSLT for some design reason), the 50ms innerHTML method is a better choice than the 1000ms pure-DOM method. You can&#8217;t have a user waiting a second or more.</p>
<p>However, when creating only a handful of DOM elements (say even 5&#215;5), the difference in speed is negligible (the user won&#8217;t notice a 10ms difference) &#8211; the opportunities/features/standards of DOM node creation is a better choice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: digitalIchi</title>
		<link>http://ajaxian.com/archives/javascript-html-construction-benchmark/comment-page-1#comment-264461</link>
		<dc:creator>digitalIchi</dc:creator>
		<pubDate>Thu, 05 Jun 2008 17:57:45 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/javascript-html-construction-benchmark#comment-264461</guid>
		<description>Cool script, the one thing I would also add to the test is applying attributes to the divs.  In past tests, I have noticed to attribute manipulation can be slow.</description>
		<content:encoded><![CDATA[<p>Cool script, the one thing I would also add to the test is applying attributes to the divs.  In past tests, I have noticed to attribute manipulation can be slow.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
