<?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: Hi-performance Javascript Tips #2</title>
	<atom:link href="http://unscriptable.com/index.php/2009/03/19/hi-performance-javascript-tips-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://unscriptable.com/index.php/2009/03/19/hi-performance-javascript-tips-2/</link>
	<description>Nothing is impossible.  Even on the Web.</description>
	<lastBuildDate>Mon, 28 Jun 2010 22:12:59 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Sjonner</title>
		<link>http://unscriptable.com/index.php/2009/03/19/hi-performance-javascript-tips-2/comment-page-1/#comment-553</link>
		<dc:creator>Sjonner</dc:creator>
		<pubDate>Thu, 21 May 2009 13:01:35 +0000</pubDate>
		<guid isPermaLink="false">http://unscriptable.com/index.php/2009/03/19/hi-performance-javascript-tips-2/#comment-553</guid>
		<description>&lt;a href=&quot;#comment-552&quot; rel=&quot;nofollow&quot;&gt;@Sjonner&lt;/a&gt; 
Never mind the .concat function, I made an error in the test, it is about as fast as the += operator, only in IE6 + 7 it is slower.</description>
		<content:encoded><![CDATA[<p><a href="#comment-552" rel="nofollow">@Sjonner</a><br />
Never mind the .concat function, I made an error in the test, it is about as fast as the += operator, only in IE6 + 7 it is slower.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sjonner</title>
		<link>http://unscriptable.com/index.php/2009/03/19/hi-performance-javascript-tips-2/comment-page-1/#comment-552</link>
		<dc:creator>Sjonner</dc:creator>
		<pubDate>Thu, 21 May 2009 12:48:45 +0000</pubDate>
		<guid isPermaLink="false">http://unscriptable.com/index.php/2009/03/19/hi-performance-javascript-tips-2/#comment-552</guid>
		<description>Hi,

How did you test the functions for the speed comparison?

I compared your method, the + and += operators, and the native String.concat() function, but in all browsers the .contact function beats the other methods of string concatenation.

Results for 10000 repetitions:
    StringBuilder  +=      String.concat()
IE6 94ms           531ms   16ms
IE7 110ms          672ms   15ms
IE8 63ms           15ms    16ms
FF3 43ms           5ms     4ms

In Firefox 3.0 and IE8 the + and += operators perform even better than your function in my test, your function only performs better in IE6 and IE7.

But I only used a simple loop to concatenate strings, so I was curious about how you got your test results.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>How did you test the functions for the speed comparison?</p>
<p>I compared your method, the + and += operators, and the native String.concat() function, but in all browsers the .contact function beats the other methods of string concatenation.</p>
<p>Results for 10000 repetitions:<br />
    StringBuilder  +=      String.concat()<br />
IE6 94ms           531ms   16ms<br />
IE7 110ms          672ms   15ms<br />
IE8 63ms           15ms    16ms<br />
FF3 43ms           5ms     4ms</p>
<p>In Firefox 3.0 and IE8 the + and += operators perform even better than your function in my test, your function only performs better in IE6 and IE7.</p>
<p>But I only used a simple loop to concatenate strings, so I was curious about how you got your test results.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Speedy</title>
		<link>http://unscriptable.com/index.php/2009/03/19/hi-performance-javascript-tips-2/comment-page-1/#comment-551</link>
		<dc:creator>Speedy</dc:creator>
		<pubDate>Thu, 21 May 2009 07:42:57 +0000</pubDate>
		<guid isPermaLink="false">http://unscriptable.com/index.php/2009/03/19/hi-performance-javascript-tips-2/#comment-551</guid>
		<description>Would be interesting to see your test case too. I got no speed bust using this :

start=new Date()
s=&#039;&#039;
for (i=0;i&lt;1000000;i++) s+=&#039;Hello World&#039;
sl=s.length
end=new Date()
document.writeln(&#039;string &#039;,end.getTime()-start.getTime())

start=new Date()
sb=new StringBuilder()
for (i=0;i&lt;1000000;i++) sb.append(&#039;Hello World&#039;)
sbl=sb.toString().length
end=new Date()
document.writeln(&#039;StringBuffer &#039;,end.getTime()-start.getTime())

And the results :

 - FireFox 3.0.10 :
string 991
StringBuffer 10177

 - SeaMonkey 1.1.16 :
string 2611
StringBuffer 16216

 - Opera 9.64 :
string 816
StringBuffer 4510

 - Midori 0.1.6 :
string 1773
StringBuffer 2332</description>
		<content:encoded><![CDATA[<p>Would be interesting to see your test case too. I got no speed bust using this :</p>
<p>start=new Date()<br />
s=&#8221;<br />
for (i=0;i&lt;1000000;i++) s+=&#8217;Hello World&#8217;<br />
sl=s.length<br />
end=new Date()<br />
document.writeln(&#8217;string &#8216;,end.getTime()-start.getTime())</p>
<p>start=new Date()<br />
sb=new StringBuilder()<br />
for (i=0;i&lt;1000000;i++) sb.append(&#8217;Hello World&#8217;)<br />
sbl=sb.toString().length<br />
end=new Date()<br />
document.writeln(&#8217;StringBuffer &#8216;,end.getTime()-start.getTime())</p>
<p>And the results :</p>
<p> &#8211; FireFox 3.0.10 :<br />
string 991<br />
StringBuffer 10177</p>
<p> &#8211; SeaMonkey 1.1.16 :<br />
string 2611<br />
StringBuffer 16216</p>
<p> &#8211; Opera 9.64 :<br />
string 816<br />
StringBuffer 4510</p>
<p> &#8211; Midori 0.1.6 :<br />
string 1773<br />
StringBuffer 2332</p>
]]></content:encoded>
	</item>
</channel>
</rss>
