<?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: Clear C# StringBuilder</title>
	<atom:link href="http://www.csharp411.com/clear-c-stringbuilder/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.csharp411.com/clear-c-stringbuilder/</link>
	<description>C# Development</description>
	<lastBuildDate>Fri, 03 Feb 2012 11:14:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: cristobal</title>
		<link>http://www.csharp411.com/clear-c-stringbuilder/#comment-895</link>
		<dc:creator>cristobal</dc:creator>
		<pubDate>Fri, 20 May 2011 14:01:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.csharp411.com/clear-c-stringbuilder/#comment-895</guid>
		<description>If you want to mesure time in asp.net I sugest use a StopWatch, is more acurate than un datetime.now...

Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
{
do something
}
stopWatch.Stop();
Console.WriteLine(stopWatch.ElapsedMilliseconds.ToString());</description>
		<content:encoded><![CDATA[<p>If you want to mesure time in asp.net I sugest use a StopWatch, is more acurate than un datetime.now&#8230;</p>
<p>Stopwatch stopWatch = new Stopwatch();<br />
stopWatch.Start();<br />
{<br />
do something<br />
}<br />
stopWatch.Stop();<br />
Console.WriteLine(stopWatch.ElapsedMilliseconds.ToString());</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fernando H. Rosa</title>
		<link>http://www.csharp411.com/clear-c-stringbuilder/#comment-894</link>
		<dc:creator>Fernando H. Rosa</dc:creator>
		<pubDate>Mon, 28 Mar 2011 12:10:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.csharp411.com/clear-c-stringbuilder/#comment-894</guid>
		<description>Just for information of those who found this post via search engine, in .NET Framework 4.0 the StringBuilder class already have an &quot;Clear&quot; method.
So, just call: sb.Clear()</description>
		<content:encoded><![CDATA[<p>Just for information of those who found this post via search engine, in .NET Framework 4.0 the StringBuilder class already have an &#8220;Clear&#8221; method.<br />
So, just call: sb.Clear()</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Unmesh Kondolikar</title>
		<link>http://www.csharp411.com/clear-c-stringbuilder/#comment-893</link>
		<dc:creator>Unmesh Kondolikar</dc:creator>
		<pubDate>Fri, 14 May 2010 12:06:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.csharp411.com/clear-c-stringbuilder/#comment-893</guid>
		<description>If you want a Clear method for more intuitive syntax you can write an extension method on the StringBuilder class and set the length to 0 in that method.</description>
		<content:encoded><![CDATA[<p>If you want a Clear method for more intuitive syntax you can write an extension method on the StringBuilder class and set the length to 0 in that method.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.csharp411.com/clear-c-stringbuilder/#comment-892</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Tue, 26 Jan 2010 00:23:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.csharp411.com/clear-c-stringbuilder/#comment-892</guid>
		<description>According to these guys:
http://stackoverflow.com/questions/266923/is-using-stringbuilder-remove-method-more-memory-efficient-than-creating-a-new-st

Option 2 is faster if you initialize the capacity of the new StringBuilder (to 32 in their case).</description>
		<content:encoded><![CDATA[<p>According to these guys:<br />
<a href="http://stackoverflow.com/questions/266923/is-using-stringbuilder-remove-method-more-memory-efficient-than-creating-a-new-st" rel="nofollow">http://stackoverflow.com/questions/266923/is-using-stringbuilder-remove-method-more-memory-efficient-than-creating-a-new-st</a></p>
<p>Option 2 is faster if you initialize the capacity of the new StringBuilder (to 32 in their case).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: timm</title>
		<link>http://www.csharp411.com/clear-c-stringbuilder/#comment-891</link>
		<dc:creator>timm</dc:creator>
		<pubDate>Thu, 05 Mar 2009 01:05:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.csharp411.com/clear-c-stringbuilder/#comment-891</guid>
		<description>1. How would option 1 affect GC performance for 1M small object collection/compaction?

I assume it would slow down the GC, but perhaps not enough to worry.


2. If we break through the ~85K large object size, would option 1 start fragmenting memory?

By creating &gt;85K strings?  Then creating a new 85K StringBuilder object every time would definitely impact performance negatively.</description>
		<content:encoded><![CDATA[<p>1. How would option 1 affect GC performance for 1M small object collection/compaction?</p>
<p>I assume it would slow down the GC, but perhaps not enough to worry.</p>
<p>2. If we break through the ~85K large object size, would option 1 start fragmenting memory?</p>
<p>By creating >85K strings?  Then creating a new 85K StringBuilder object every time would definitely impact performance negatively.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.csharp411.com/clear-c-stringbuilder/#comment-890</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Thu, 05 Mar 2009 00:47:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.csharp411.com/clear-c-stringbuilder/#comment-890</guid>
		<description>1. How would option 1 affect GC performance for 1M small object collection/compaction?

2. If we break through the ~85K large object size, would option 1 start fragmenting memory?</description>
		<content:encoded><![CDATA[<p>1. How would option 1 affect GC performance for 1M small object collection/compaction?</p>
<p>2. If we break through the ~85K large object size, would option 1 start fragmenting memory?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Me</title>
		<link>http://www.csharp411.com/clear-c-stringbuilder/#comment-889</link>
		<dc:creator>Me</dc:creator>
		<pubDate>Mon, 09 Feb 2009 10:17:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.csharp411.com/clear-c-stringbuilder/#comment-889</guid>
		<description>The difference is even smaller with faster PC&#039;s. My results for 1M (your code):
new = 00:00:02.3437500, append = 00:00:01.9843750

So, while Option 2 is faster, nobody is really going to notice it anyway.</description>
		<content:encoded><![CDATA[<p>The difference is even smaller with faster PC&#8217;s. My results for 1M (your code):<br />
new = 00:00:02.3437500, append = 00:00:01.9843750</p>
<p>So, while Option 2 is faster, nobody is really going to notice it anyway.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

