<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: About the Virtue of Not Improving Performance</title>
	<atom:link href="http://ajdotnet.wordpress.com/2007/05/20/about-the-virtue-of-not-improving-performance/feed/" rel="self" type="application/rss+xml" />
	<link>http://ajdotnet.wordpress.com/2007/05/20/about-the-virtue-of-not-improving-performance/</link>
	<description>Thoughts and informations I think worthwhile to share...</description>
	<lastBuildDate>Fri, 18 Sep 2009 01:42:12 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: StringBuilder is not always faster - Part 2 &#187; Chinh Do</title>
		<link>http://ajdotnet.wordpress.com/2007/05/20/about-the-virtue-of-not-improving-performance/#comment-5449</link>
		<dc:creator>StringBuilder is not always faster - Part 2 &#187; Chinh Do</dc:creator>
		<pubDate>Sat, 29 Sep 2007 06:20:00 +0000</pubDate>
		<guid isPermaLink="false">http://ajdotnet.wordpress.com/2007/05/20/about-the-virtue-of-not-improving-performance/#comment-5449</guid>
		<description>[...] has written a post detailing string.Concat here. Thanks, AJ, for pointing it [...]</description>
		<content:encoded><![CDATA[<p>[...] has written a post detailing string.Concat here. Thanks, AJ, for pointing it [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chinh Do</title>
		<link>http://ajdotnet.wordpress.com/2007/05/20/about-the-virtue-of-not-improving-performance/#comment-5264</link>
		<dc:creator>Chinh Do</dc:creator>
		<pubDate>Wed, 19 Sep 2007 16:34:17 +0000</pubDate>
		<guid isPermaLink="false">http://ajdotnet.wordpress.com/2007/05/20/about-the-virtue-of-not-improving-performance/#comment-5264</guid>
		<description>Thanks for the info re string.Concat. Yes I agree that there is such a thing as over-optimization. You have to weigh your optimizations against time lost, harder to understand code, and higher long-term maintenance.</description>
		<content:encoded><![CDATA[<p>Thanks for the info re string.Concat. Yes I agree that there is such a thing as over-optimization. You have to weigh your optimizations against time lost, harder to understand code, and higher long-term maintenance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ocho Cinco</title>
		<link>http://ajdotnet.wordpress.com/2007/05/20/about-the-virtue-of-not-improving-performance/#comment-3638</link>
		<dc:creator>Ocho Cinco</dc:creator>
		<pubDate>Sat, 30 Jun 2007 18:15:38 +0000</pubDate>
		<guid isPermaLink="false">http://ajdotnet.wordpress.com/2007/05/20/about-the-virtue-of-not-improving-performance/#comment-3638</guid>
		<description>Oops, irony storm level 5? (stolen from another blog you might know talking about Paris H.)

Well, I guess you are a smart guy who knows what he is doing (no irony). You might be using your tools in a more &quot;advanced&quot; way (hey, still no irony) than other users (who might prefer &quot;programming with pictures&quot; based on their skills). Maybe some guidelines and tools are simply targeted towards such an audience?

Virtuals: The collections in .Net 2.0 are a framework widely used and something like that should be tuned for a good run-time rather than a better design-time performance. And that library looks quite sexy to me.

Virtuals 2: Less advanced users are easier helped with &quot;automatic&quot; optimizations (compiler, JIT) - that can yield terrific gains (I strongly  believe the guys building the JIT know what they are doing - stupid thinking, I know). Virtuals hamper that, because such functions cannot be inlined. So you hurt yourself. Ouch. But at least the Class diagram looks smooth. Congrats!

Sealing your classes:
Doing things implicitly sucks in my eyes, doing things explicitly is king. And based on some mechanisms which changed from Netfx2 to netfx3 it looks like other people are thinking the same. If you want an extension point, say that you want an extensions point. Otherwise, no extension points by default. If you think that this means I like Honecker, go for it. I mean, most classes are never derived from.

foreach: Using foreach on an array for example has almost no overhead. And Rico never said that you should never use foreach:-)

And regarding Microsoft: when you got some 70.000 emps, surely you going to end up with a pretty high number of &quot;so-so&quot;s, as I would call them. And the worst thing is, such people rule the world. And that really hurts. Ouch.

How do you like Linq? (still no irony. Am I getting old?)</description>
		<content:encoded><![CDATA[<p>Oops, irony storm level 5? (stolen from another blog you might know talking about Paris H.)</p>
<p>Well, I guess you are a smart guy who knows what he is doing (no irony). You might be using your tools in a more &#8220;advanced&#8221; way (hey, still no irony) than other users (who might prefer &#8220;programming with pictures&#8221; based on their skills). Maybe some guidelines and tools are simply targeted towards such an audience?</p>
<p>Virtuals: The collections in .Net 2.0 are a framework widely used and something like that should be tuned for a good run-time rather than a better design-time performance. And that library looks quite sexy to me.</p>
<p>Virtuals 2: Less advanced users are easier helped with &#8220;automatic&#8221; optimizations (compiler, JIT) &#8211; that can yield terrific gains (I strongly  believe the guys building the JIT know what they are doing &#8211; stupid thinking, I know). Virtuals hamper that, because such functions cannot be inlined. So you hurt yourself. Ouch. But at least the Class diagram looks smooth. Congrats!</p>
<p>Sealing your classes:<br />
Doing things implicitly sucks in my eyes, doing things explicitly is king. And based on some mechanisms which changed from Netfx2 to netfx3 it looks like other people are thinking the same. If you want an extension point, say that you want an extensions point. Otherwise, no extension points by default. If you think that this means I like Honecker, go for it. I mean, most classes are never derived from.</p>
<p>foreach: Using foreach on an array for example has almost no overhead. And Rico never said that you should never use foreach:-)</p>
<p>And regarding Microsoft: when you got some 70.000 emps, surely you going to end up with a pretty high number of &#8220;so-so&#8221;s, as I would call them. And the worst thing is, such people rule the world. And that really hurts. Ouch.</p>
<p>How do you like Linq? (still no irony. Am I getting old?)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ajdotnet</title>
		<link>http://ajdotnet.wordpress.com/2007/05/20/about-the-virtue-of-not-improving-performance/#comment-3546</link>
		<dc:creator>ajdotnet</dc:creator>
		<pubDate>Sat, 23 Jun 2007 10:11:14 +0000</pubDate>
		<guid isPermaLink="false">http://ajdotnet.wordpress.com/2007/05/20/about-the-virtue-of-not-improving-performance/#comment-3546</guid>
		<description>@Ocho
Your first point: I never said that there is no performance gain in avoiding virtuals and I didn&#039;t even mention generics. Actually I like generics for their type safety and clean class design does _not_ mandate virtual methods. Anyway, this is not the point. Someone (Microsoft actually) says you should seal or avoid virtual methods and they say you should do that for performance reasons. My stance is that perfomance may be something to consider but I refuse to let it dictate (to the point of spoiling) my class design. If in certain cases generics are an alternative approach that serves clean design and performance at the same time, great. 

Point 2: So you are saying that having the option to do something will lead to the abuse of that feature, therefore only permit that option in certain cases? And you the one to decide? Reminds me of communism, and the party to decide what people should be allowed to do. No thanks, I&#039;ll stay in the free part of the world and live with the consequences.

Last point: Why, from the microsoft hell that is. But there _is_ a chance that they don&#039;t know what they are talking about. You still might want to have a look at the msdn reference I gave, they also provide ample reasons for their suggestion. Personally I haven&#039;t tested .NET 2.0 but with 1.x the overhead definitely was noteworthy; calling the enumerator, casting with type check, IDisposable awareness; these things simply don&#039;t happen automatically with for loops. Whether this will have a noteable effect certainly depends on the collection.

NOI
AJ.NET</description>
		<content:encoded><![CDATA[<p>@Ocho<br />
Your first point: I never said that there is no performance gain in avoiding virtuals and I didn&#8217;t even mention generics. Actually I like generics for their type safety and clean class design does _not_ mandate virtual methods. Anyway, this is not the point. Someone (Microsoft actually) says you should seal or avoid virtual methods and they say you should do that for performance reasons. My stance is that perfomance may be something to consider but I refuse to let it dictate (to the point of spoiling) my class design. If in certain cases generics are an alternative approach that serves clean design and performance at the same time, great. </p>
<p>Point 2: So you are saying that having the option to do something will lead to the abuse of that feature, therefore only permit that option in certain cases? And you the one to decide? Reminds me of communism, and the party to decide what people should be allowed to do. No thanks, I&#8217;ll stay in the free part of the world and live with the consequences.</p>
<p>Last point: Why, from the microsoft hell that is. But there _is_ a chance that they don&#8217;t know what they are talking about. You still might want to have a look at the msdn reference I gave, they also provide ample reasons for their suggestion. Personally I haven&#8217;t tested .NET 2.0 but with 1.x the overhead definitely was noteworthy; calling the enumerator, casting with type check, IDisposable awareness; these things simply don&#8217;t happen automatically with for loops. Whether this will have a noteable effect certainly depends on the collection.</p>
<p>NOI<br />
AJ.NET</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ocho</title>
		<link>http://ajdotnet.wordpress.com/2007/05/20/about-the-virtue-of-not-improving-performance/#comment-3302</link>
		<dc:creator>Ocho</dc:creator>
		<pubDate>Sat, 09 Jun 2007 20:11:50 +0000</pubDate>
		<guid isPermaLink="false">http://ajdotnet.wordpress.com/2007/05/20/about-the-virtue-of-not-improving-performance/#comment-3302</guid>
		<description>Regarding the &quot;sealing virtual methods&quot; and &quot;Consider the Tradeoffs of Virtual Members&quot;: Did you ever take a look why the hell generic collections perform (in many cases) better (read &quot;faster&quot;) than the non-generic ones? Main reason are not the removed casts/(un)boxing (unboxing is very cheap) but the methods are no longer virtual hence the reduced indirections hence the performance gain. And based on a clean design these methods should be virtual, but they are not. Performance trade-off. I like it. It was the right way to go.

Regarding the &quot;sealed&quot; at all: I never understood why classes are not sealed by default. This is the design decision I will never ever understand. People create ridiculously complicated inheritance hierarchies for extensions that never happen because everybody happens to be a great architect these days? Think again.

And where the hell did you get the &quot;Use for loops rather than foreach&quot; suggestion from? That is definitely not correct. foreach can surely beat a for loop in many cases. And many for loops beat foreachs:-)

Cheers.</description>
		<content:encoded><![CDATA[<p>Regarding the &#8220;sealing virtual methods&#8221; and &#8220;Consider the Tradeoffs of Virtual Members&#8221;: Did you ever take a look why the hell generic collections perform (in many cases) better (read &#8220;faster&#8221;) than the non-generic ones? Main reason are not the removed casts/(un)boxing (unboxing is very cheap) but the methods are no longer virtual hence the reduced indirections hence the performance gain. And based on a clean design these methods should be virtual, but they are not. Performance trade-off. I like it. It was the right way to go.</p>
<p>Regarding the &#8220;sealed&#8221; at all: I never understood why classes are not sealed by default. This is the design decision I will never ever understand. People create ridiculously complicated inheritance hierarchies for extensions that never happen because everybody happens to be a great architect these days? Think again.</p>
<p>And where the hell did you get the &#8220;Use for loops rather than foreach&#8221; suggestion from? That is definitely not correct. foreach can surely beat a for loop in many cases. And many for loops beat foreachs:-)</p>
<p>Cheers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ray Booysen</title>
		<link>http://ajdotnet.wordpress.com/2007/05/20/about-the-virtue-of-not-improving-performance/#comment-2981</link>
		<dc:creator>Ray Booysen</dc:creator>
		<pubDate>Fri, 25 May 2007 22:34:48 +0000</pubDate>
		<guid isPermaLink="false">http://ajdotnet.wordpress.com/2007/05/20/about-the-virtue-of-not-improving-performance/#comment-2981</guid>
		<description>Don&#039;t forget String.Format() internally creates a string builder anyway. ;)</description>
		<content:encoded><![CDATA[<p>Don&#8217;t forget String.Format() internally creates a string builder anyway. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Curran</title>
		<link>http://ajdotnet.wordpress.com/2007/05/20/about-the-virtue-of-not-improving-performance/#comment-2971</link>
		<dc:creator>James Curran</dc:creator>
		<pubDate>Fri, 25 May 2007 15:03:36 +0000</pubDate>
		<guid isPermaLink="false">http://ajdotnet.wordpress.com/2007/05/20/about-the-virtue-of-not-improving-performance/#comment-2971</guid>
		<description>May favortie example of StringBuilder abuse  (seen dozens of times)
string A = &quot;....&quot;;
string B = &quot;....&quot;;
StringBuilder sb = ....
// :
sb.Append(A + B);

SO, let&#039;s see... We&#039;ve used a StringBuilder to avoid a string concatenation, and then we do one anyway.....</description>
		<content:encoded><![CDATA[<p>May favortie example of StringBuilder abuse  (seen dozens of times)<br />
string A = &#8220;&#8230;.&#8221;;<br />
string B = &#8220;&#8230;.&#8221;;<br />
StringBuilder sb = &#8230;.<br />
// :<br />
sb.Append(A + B);</p>
<p>SO, let&#8217;s see&#8230; We&#8217;ve used a StringBuilder to avoid a string concatenation, and then we do one anyway&#8230;..</p>
]]></content:encoded>
	</item>
</channel>
</rss>
