<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Pithy Perf Patterns</title><link>http://blogs.msdn.com/brada/archive/2004/01/09/49017.aspx</link><description>Maoni Stephens, Perf PM on the CLR team sent me some key &amp;#8220;patterns&amp;#8221;... You will see I have not expanded on any of them, I am sure we can talk Rico into blogging on any of these at length if we ask nicely.... avoid finalizers; use the Dispose</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Achieving high performance with ASP.NET</title><link>http://blogs.msdn.com/brada/archive/2004/01/09/49017.aspx#49079</link><pubDate>Fri, 09 Jan 2004 20:06:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:49079</guid><dc:creator>James Geurts' Blog</dc:creator><description /></item><item><title>re: Pithy Perf Patterns</title><link>http://blogs.msdn.com/brada/archive/2004/01/09/49017.aspx#49210</link><pubDate>Fri, 09 Jan 2004 22:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:49210</guid><dc:creator>Brad Wilson</dc:creator><description>I think I'd like an expansion on #9. It's hard for me to know whether Microsoft thinks I'm thinking or not. :)&lt;br&gt;&lt;br&gt;We use XML for configuration files. Why? Because the XML parser is written. Writing parsers for text files is a lame way to spend your day.</description></item><item><title>re: Pithy Perf Patterns</title><link>http://blogs.msdn.com/brada/archive/2004/01/09/49017.aspx#49283</link><pubDate>Sat, 10 Jan 2004 01:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:49283</guid><dc:creator>Rico Mariani</dc:creator><description>It's funny how things work out.  I suspect the email that Maoni sent Brad was distilled from the slides she and I made for a talk we gave together a few weeks ago which was in turn distilled from recent entries on my blog so I've already actually commented on most of those.&lt;br&gt;&lt;br&gt;See &lt;a target="_new" href="http://weblogs.asp.net/ricom/"&gt;http://weblogs.asp.net/ricom/&lt;/a&gt;&lt;br&gt;&lt;br&gt;Now the particulars of XML and the XML DOM is that I often find folks picking up the (sledgehammer of an) XML parser to parse, at great expense, a comparatively small amount of data.  Often precisely because it is so easy to do just that.  &lt;br&gt;&lt;br&gt;This isn't always the wrong thing to do of course; We each have to make choices as to where to invest our time, both processing time and development time.  But, and this is especially true for simple configuration data, there are comparatively few benefits to using XML and the cost could be higher than you want to bear.  So that advice makes our greatest hits list because it's a common pitfall.  And not The Pit of Success.&lt;br&gt;&lt;br&gt;So #9 simply boils down to make an informed decision.  Doing anything by reflex is a recipe for Big Trubble.</description></item><item><title>re: Pithy Perf Patterns</title><link>http://blogs.msdn.com/brada/archive/2004/01/09/49017.aspx#49318</link><pubDate>Sat, 10 Jan 2004 03:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:49318</guid><dc:creator>_</dc:creator><description>Check out &amp;quot;Improving .net Application Performance and Scalability&amp;quot;&lt;br&gt;&lt;br&gt;&lt;a target="_new" href="http://www.gotdotnet.com/Community/Workspaces/Workspace.aspx?id=540f8bd7-be95-45f7-a477-919d23294553"&gt;http://www.gotdotnet.com/Community/Workspaces/Workspace.aspx?id=540f8bd7-be95-45f7-a477-919d23294553&lt;/a&gt;</description></item><item><title>re: Pithy Perf Patterns</title><link>http://blogs.msdn.com/brada/archive/2004/01/09/49017.aspx#49380</link><pubDate>Sat, 10 Jan 2004 11:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:49380</guid><dc:creator>David Levine</dc:creator><description>&amp;gt;1. avoid finalizers; use the Dispose pattern&lt;br&gt;&lt;br&gt;I'd expand this a bit. If an object implements the Dispose interface then it should also implement a Finalizer as a backstop, and then I would treat it as at least a warning (log it), and possibly an error (throw exception), if the finalizer ever ran.  The idea is that the Dispose is a contract that the object requires the client to honor. &lt;br&gt;The goal is to catch violations during the debug phase before it ever ships to customers.&lt;br&gt;</description></item><item><title>re: Pithy Perf Patterns</title><link>http://blogs.msdn.com/brada/archive/2004/01/09/49017.aspx#49407</link><pubDate>Sat, 10 Jan 2004 15:06:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:49407</guid><dc:creator>Brad Abrams</dc:creator><description>Thanks David -- I generally agree with your post, but I might not go as far as you suggest.  The Dispose pattern is mostly a perf optimization... That is for correctness the finalizer running is not a bad thing so I would not throw and exception from the finalizer.  The Finalizer is a great backup plan.  &lt;br&gt;We know from experince with COM that developers have trouble explicily freeing instances, I don't want to go back to that world.. We should continue to take advantage of the GC here.</description></item><item><title>re: Pithy Perf Patterns</title><link>http://blogs.msdn.com/brada/archive/2004/01/09/49017.aspx#49447</link><pubDate>Sat, 10 Jan 2004 17:02:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:49447</guid><dc:creator>David Levine</dc:creator><description>Thanks Brad. Most of the subtle/weird problems we've run are at the intersection of .net and COM, and it's caused us to adopt a paranoid style with releasing resources, hence the rule I suggested. I completely agree that using the GC to free resources is far superior then relying on developer hygiene. But...&lt;br&gt;&lt;br&gt;Currently we really can't go very far in .net before we have to interact with the underlying system objects (files, windows, networks, COM, threads, etc.) with open/use/close semantics. If all resources were managed we probably wouldn't need Dipose/Finalizers at all - try-finally blocks would handle most cleanup requirements. Until we reach that happy day we still need to use discipline. In our case we plan to surround the throw statements with #if DEBUG so that shipping code wont blow chow.&lt;br&gt;&lt;br&gt;&lt;br&gt;</description></item><item><title>re: Pithy Perf Patterns</title><link>http://blogs.msdn.com/brada/archive/2004/01/09/49017.aspx#49469</link><pubDate>Sat, 10 Jan 2004 19:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:49469</guid><dc:creator>josh</dc:creator><description>but isn't the performance optimization of the suggested use of the dispose pattern over the use of finalizers that your objects don't have to be promoted in the GC so that at some time in the future the finalizer thread can come around and finalize them?&lt;br&gt;&lt;br&gt;by putting in a &amp;quot;backup&amp;quot; finalizer it seems that you completly negate that optimization...</description></item><item><title>re: Pithy Perf Patterns</title><link>http://blogs.msdn.com/brada/archive/2004/01/09/49017.aspx#49473</link><pubDate>Sat, 10 Jan 2004 19:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:49473</guid><dc:creator>David Levine</dc:creator><description>The Dispose method calls GC.SuppressFinalize(this) so that the finalizer only gets called if the Dispose method is never invoked, so we still get our perf improvement if the object is used correctly.&lt;br&gt;</description></item><item><title>re: Pithy Perf Patterns</title><link>http://blogs.msdn.com/brada/archive/2004/01/09/49017.aspx#57786</link><pubDate>Mon, 12 Jan 2004 12:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:57786</guid><dc:creator>Claude Ballew</dc:creator><description>I would have before a recent project completely agreed with you on ThreadPools instead of managing your own threads. In the Framework 1.0.3705 ( I have not tried the same with 1.1 or higher ) some interesting things happened inside of a Windows Service I had written. &lt;br&gt;&lt;br&gt;The threads were in a thread pool using the Threading timer. The first thing I noticed was my first thread created was always favored. The other threads did receive clock cycles, but not as consistently as the first thread did. &lt;br&gt;&lt;br&gt;The other thing that happened to me was a mis behaving DataProvider written by a non-Microsoft vendor who shall remain nameless :-) threw an unknown exception. This in itself was not a problem, but my next call into that provider went to never, never land. Again no problem except that at that point all my other threads stopped receiving clock cycles, no ticks ever fired again on any of the threads, but my primary thread and the service were still live.&lt;br&gt;&lt;br&gt;I had much code devoted to handling awry thread, but that code never got hit because my app was unaware of the issue. &lt;br&gt;&lt;br&gt;Now I have my own threads, spawned by me and a health thread to make sure all my threads are behaving and communicating in a timely matter and no more issues. I still believe in threadpools and I will probably try again in 1.1 to see if the same behavior is exhibited, but for my production code, I'll keep my approach until threadpools win me back.&lt;br&gt;&lt;br&gt;&lt;br&gt;</description></item><item><title>Design Guideline Updates</title><link>http://blogs.msdn.com/brada/archive/2004/01/09/49017.aspx#60106</link><pubDate>Mon, 19 Jan 2004 13:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:60106</guid><dc:creator>Chris Burrows .NET Blog</dc:creator><description /></item><item><title>re: Pithy Perf Patterns</title><link>http://blogs.msdn.com/brada/archive/2004/01/09/49017.aspx#60607</link><pubDate>Tue, 20 Jan 2004 15:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:60607</guid><dc:creator>eriksalt</dc:creator><description>I would like to see some more information on the threadpool requirement.  Is the performance recomendation only because the threads are 'pooled', or is this a case like memory management where rolling your own tends to make things up?  I have heard allot of talk refering to the threadpool as having performance limitations, and have seen developers in the field rolling their own threadpools.  I think a more thorough treatment of this topic would enlighten many people.</description></item><item><title>re: Pithy Perf Patterns</title><link>http://blogs.msdn.com/brada/archive/2004/01/09/49017.aspx#62425</link><pubDate>Sat, 24 Jan 2004 04:16:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:62425</guid><dc:creator>Louis Parks</dc:creator><description>I must say it's a bit odd to hear someone suggest that using XML for a relatively small amount of data is not recommended.  Visual Studio defaults all app config files to an XML format, all web app config files to an XML format, the VS project files to an XML format, etc.  Often, these XML files hold very little data.  Perhaps someone can clarify this for me?</description></item><item><title>Design guidelines from Microsoft</title><link>http://blogs.msdn.com/brada/archive/2004/01/09/49017.aspx#64400</link><pubDate>Thu, 29 Jan 2004 18:30:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:64400</guid><dc:creator>James Geurts' Blog</dc:creator><description /></item><item><title>Microsoft Design Guidelines</title><link>http://blogs.msdn.com/brada/archive/2004/01/09/49017.aspx#82098</link><pubDate>Mon, 01 Mar 2004 20:34:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:82098</guid><dc:creator>James Geurts' Blog</dc:creator><description /></item><item><title>re: Pithy Perf Patterns</title><link>http://blogs.msdn.com/brada/archive/2004/01/09/49017.aspx#82685</link><pubDate>Tue, 02 Mar 2004 16:08:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:82685</guid><dc:creator>Codezen</dc:creator><description>Regarding Louis Parks comment.....&lt;br&gt;&lt;br&gt;It makes lot of sense to have config info in the XML file like app.config. The config file contains parameters that define the way an application would behave. E.g. a windows service that polls a resource at a configurable interval. If you need to to quicken up the polling, just change the config key, restart the service and thats it........now ain't that easy. &lt;br&gt;&lt;br&gt;As far as perf is concerned....it is not that perf intensive. When an app domain loads, the config params are loaded in an in-memory collection by a section handler (parsing is done for that config section during this process) e.g. the keys in the appSettings section are handled by NameValueFileSectionHandler. So when you access these values, they are fetched from the in-memory collection.......no parsing here...so no perf issue.&lt;br&gt;&lt;br&gt;Using the XML for data storage should be considered judiciously. Nothing like a good ol' RDBMS to store/manipulate/read the data. As far as data transmission is concerned XML can be a good idea e.g. if there is a case of transmission of data between two heterogeneous systems. &lt;br&gt;&lt;br&gt;All and all Maoni's pt. 9 hits the nail on the head.&lt;br&gt;</description></item><item><title>Casting in C#</title><link>http://blogs.msdn.com/brada/archive/2004/01/09/49017.aspx#6974826</link><pubDate>Fri, 04 Jan 2008 06:40:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6974826</guid><dc:creator>Nick Parker</dc:creator><description>&lt;p&gt;Casting in C#&lt;/p&gt;</description></item><item><title>
	Casting in C#
</title><link>http://blogs.msdn.com/brada/archive/2004/01/09/49017.aspx#6974827</link><pubDate>Fri, 04 Jan 2008 06:40:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6974827</guid><dc:creator>
	Casting in C#
</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.developernotes.com/post/Casting-in-C.aspx"&gt;http://www.developernotes.com/post/Casting-in-C.aspx&lt;/a&gt;&lt;/p&gt;
</description></item><item><title> Brad Abrams Pithy Perf Patterns | Weak Bladder</title><link>http://blogs.msdn.com/brada/archive/2004/01/09/49017.aspx#9716996</link><pubDate>Tue, 09 Jun 2009 21:29:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9716996</guid><dc:creator> Brad Abrams Pithy Perf Patterns | Weak Bladder</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://weakbladder.info/story.php?id=6859"&gt;http://weakbladder.info/story.php?id=6859&lt;/a&gt;&lt;/p&gt;
</description></item><item><title> Brad Abrams Pithy Perf Patterns | pool toys</title><link>http://blogs.msdn.com/brada/archive/2004/01/09/49017.aspx#9774662</link><pubDate>Thu, 18 Jun 2009 11:56:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9774662</guid><dc:creator> Brad Abrams Pithy Perf Patterns | pool toys</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://pooltoysite.info/story.php?id=6918"&gt;http://pooltoysite.info/story.php?id=6918&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>