<?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>Common Sources of Processor Performance Penalties: Five Issues</title><link>http://blogs.msdn.com/ricom/archive/2005/03/01/382756.aspx</link><description>Modern processors run at incredibly high clock rates and can often execute multiple instructions concurrently. When things are going perfectly these machines plow through instructions at multiple billions per second, yet these maximums are rarely achieved</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Common Sources of Processor Performance Penalties: Five Issues</title><link>http://blogs.msdn.com/ricom/archive/2005/03/01/382756.aspx#382763</link><pubDate>Tue, 01 Mar 2005 23:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:382763</guid><dc:creator>Darren Oakey</dc:creator><description>Rico, &lt;br&gt;Gotta say - I'm loving all these performance articles.  They're interesting for themselves, and also for what they incidentally tell us about the internals.&lt;br&gt;&lt;br&gt;Particularly loved the previous ones where you did the GC tests.</description></item><item><title>re: Common Sources of Processor Performance Penalties: Five Issues</title><link>http://blogs.msdn.com/ricom/archive/2005/03/01/382756.aspx#382887</link><pubDate>Wed, 02 Mar 2005 00:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:382887</guid><dc:creator>Rico Mariani</dc:creator><description>Thanks for the kind words Darren.&lt;br&gt;&lt;br&gt;I had some thoughts as to what topics might have made a good #6, #7 etc. but maybe it's more useful to see what my readers think should have been #6. </description></item><item><title>re: Common Sources of Processor Performance Penalties: Five Issues</title><link>http://blogs.msdn.com/ricom/archive/2005/03/01/382756.aspx#383356</link><pubDate>Wed, 02 Mar 2005 05:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:383356</guid><dc:creator>Kent Boogaart</dc:creator><description>Yep, excellent article as per usual Rico.&lt;br&gt;&lt;br&gt;Cache misses due to internal waste must be very common indeed. How often do you have a collection of objects and want to perform an operation or access some data of each of those objects?&lt;br&gt;&lt;br&gt;I don't really see any way to combat this problem, besides keeping types as small as possible and limiting loops over objects to where they're absolutely needed (perhaps even combining multiple loops into one). Would you agree?</description></item><item><title>re: Common Sources of Processor Performance Penalties: Five Issues</title><link>http://blogs.msdn.com/ricom/archive/2005/03/01/382756.aspx#383412</link><pubDate>Wed, 02 Mar 2005 07:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:383412</guid><dc:creator>Tommy Carlier</dc:creator><description>Great article. I love it. But I don't really know how to translate it to 'best practices'. Are there practical techniques (programming in .NET) to avoid these issues as much as possible?</description></item><item><title>Minor Correction</title><link>http://blogs.msdn.com/ricom/archive/2005/03/01/382756.aspx#383583</link><pubDate>Wed, 02 Mar 2005 15:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:383583</guid><dc:creator>Ryan Lamansky (Kardax)</dc:creator><description>&amp;quot;For data, that overhead tends to be dwarfed by locality benefits that come from using a garbage collected memory system.&amp;quot;&lt;br&gt;&lt;br&gt;This should say &amp;quot;a compacting garbage collected memory system&amp;quot;.  Emphasis on &amp;quot;compacting&amp;quot;.  A garbage collector that doesn't compact its heap does not get this benefit.&lt;br&gt;&lt;br&gt;Great article :)&lt;br&gt;&lt;br&gt;-Ryan</description></item><item><title>re: Common Sources of Processor Performance Penalties: Five Issues</title><link>http://blogs.msdn.com/ricom/archive/2005/03/01/382756.aspx#383714</link><pubDate>Wed, 02 Mar 2005 18:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:383714</guid><dc:creator>Rico Mariani</dc:creator><description>That's a good point about &amp;quot;compacting&amp;quot; -- I'm too biased by our own but there are of course other ways to do garbage collection.&lt;br&gt;&lt;br&gt;Several of the comments directly or indirectly ask how these thoughts might translate into best practices.  I think that might make a good companion article.  I'll try to get to that soon.</description></item><item><title>Processor Performance Top 5</title><link>http://blogs.msdn.com/ricom/archive/2005/03/01/382756.aspx#383994</link><pubDate>Thu, 03 Mar 2005 03:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:383994</guid><dc:creator>Mike Taulty's Weblog</dc:creator><description /></item><item><title>re: Common Sources of Processor Performance Penalties: Five Issues</title><link>http://blogs.msdn.com/ricom/archive/2005/03/01/382756.aspx#384163</link><pubDate>Thu, 03 Mar 2005 10:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:384163</guid><dc:creator>Matt</dc:creator><description>Great article.&lt;br&gt;I'm not sure that i understand the rules that the processor uses to fill the cache. I can see that from one programs perspective locality and size would make a difference but as soon as you're running in a multi tasking/threading environment where many processes may be running, won't that kill the cache as the processor jumps all over the place to service each process?&lt;br&gt;&lt;br&gt;Best practices and maybe some kind of test results to show just how much can be gained would be a fantastic article!&lt;br&gt;</description></item><item><title>re: Common Sources of Processor Performance Penalties: Five Issues</title><link>http://blogs.msdn.com/ricom/archive/2005/03/01/382756.aspx#384328</link><pubDate>Thu, 03 Mar 2005 16:33:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:384328</guid><dc:creator>Eric</dc:creator><description>&amp;quot;For data, that overhead tends to be dwarfed by locality benefits that come from using a garbage collected memory system.&amp;quot; &lt;br&gt;&lt;br&gt;Though practicaly, it doesn't happen and the linear allocation and compaction schemes actually end up maximizing stride when compared to classic allocation schemes or a segregated (unmanaged) allocator.&lt;br&gt;GC compaction has the tendency to trash the CPU cache, and GC delayed release also means that recently freed memory is unlikely to reused (while it has a high probability of being in CPU cache thanks to object cleanup logic).&lt;br&gt;&lt;br&gt;The points made in this article are interesting, but the interpretation is somewhat biased towards overestimating GC locality, which in the real world is GC's effective Achille heel.</description></item><item><title>re: Common Sources of Processor Performance Penalties: Five Issues</title><link>http://blogs.msdn.com/ricom/archive/2005/03/01/382756.aspx#384357</link><pubDate>Thu, 03 Mar 2005 17:11:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:384357</guid><dc:creator>Rico Mariani</dc:creator><description>Now I'm going to disagree with you but before I do that I want to thank you for that lucid comment because there's gems in there and this is a very slippery problem.&lt;br&gt;&lt;br&gt;Eric writes: &amp;quot;[I]n the real world [locality] is GC's effective Achille [sic] heel&amp;quot;&lt;br&gt;&lt;br&gt;That hasn't been my observation.  If I had to pick the GC's weakness it's in patterns that put it in crisis (see &amp;quot;Mid-life crisis&amp;quot; &lt;a target="_new" href="http://weblogs.asp.net/ricom/archive/2003/12/04/41281.aspx"&gt;http://weblogs.asp.net/ricom/archive/2003/12/04/41281.aspx&lt;/a&gt;).  Customers can and do run into those -- it's something I see when people come to our labs.&lt;br&gt;&lt;br&gt;In constrast I've yet to observe locality problems attributable to the GC.&lt;br&gt;&lt;br&gt;On the other hand I have seen plenty of locality issues attributable to pointer spaghetti.  That problem is universal though -- no allocator can save you from pointer spaghetti.&lt;br&gt;&lt;br&gt;But I suspect there have been lots of papers written on this topic.  I don't think there is a clear answer that's universally true.  I can only speak to problems my customers tend to have or not have.&lt;br&gt;&lt;br&gt;Finally, you *should* assume that what I write is biased.  Not because I'm being nefarious but because I base my writings on the data that I have and I don't have all the data.  It's always good to ask yourself &amp;quot;Are my scenarios similar to the ones that Rico is likely to have seen?  Are my scenarios like those of large Microsoft customers?&amp;quot;  If they are then it's more likely that my opinion will be relevant to you.</description></item><item><title>re: Common Sources of Processor Performance Penalties: Five Issues</title><link>http://blogs.msdn.com/ricom/archive/2005/03/01/382756.aspx#384597</link><pubDate>Thu, 03 Mar 2005 21:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:384597</guid><dc:creator>Simonjit Dutta</dc:creator><description>Great article &amp;amp; Thanks for covering my personal hot button, issue#3. In code density (instruction locality) issues, it may be fair to say managed code is exerting unique presssue on todays TLB architectures. I found one of the best figurative explanation for this in your article: &amp;quot;instruction pointer dancing through various assemblies and visiting tiny helpers...&amp;quot;.  These tiny helpers are often heapalloc'ed and thus are way out in the address space from where the work is done. Will tuning of prejit large assemlies be able to address the locality issues of the tiny helpers reltive to where the work gets done?</description></item><item><title>re: Common Sources of Processor Performance Penalties: Five Issues</title><link>http://blogs.msdn.com/ricom/archive/2005/03/01/382756.aspx#385125</link><pubDate>Fri, 04 Mar 2005 15:27:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:385125</guid><dc:creator>Eric</dc:creator><description>&amp;gt; It's always good to ask yourself &amp;quot;Are my scenarios similar to the ones that Rico is likely to have seen? &lt;br&gt;&amp;gt; Are my scenarios like those of large Microsoft customers?&amp;quot; &lt;br&gt;&amp;gt;If they are then it's more likely that my opinion will be relevant to you.&lt;br&gt;&lt;br&gt;Well, a better question would be: in which scenario does my theory prove correct, ie. the GC does effectively deliver higher locality, as measured with CPU-level cache miss tools?&lt;br&gt;&lt;br&gt;Don't take it personnally, you wouldn't be the first person believing in GC locality and then discovering how poor it can actually be (it may be higher than that of the Windows Heap Manager, but then, that's no great challenge to begin with).&lt;br&gt;&lt;br&gt;</description></item><item><title>re: Common Sources of Processor Performance Penalties: Five Issues</title><link>http://blogs.msdn.com/ricom/archive/2005/03/01/382756.aspx#385716</link><pubDate>Sat, 05 Mar 2005 06:28:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:385716</guid><dc:creator>Keith Patrick</dc:creator><description>Related to #2: I could have sworn I read somewhere (maybe BradA...I'm too tired to look it up tonight) that due to the cost (assuming stack-related) of throwing an exception, that it is better to prevent one via a conditional than let an exception get thrown.  Or maybe I'm misreading it, and you mean that you should use exceptions instead of return values to indicate error.  So basically, I'm asking whether the savings of exceptions is in the throwing or in the catching.</description></item><item><title>re: Common Sources of Processor Performance Penalties: Five Issues</title><link>http://blogs.msdn.com/ricom/archive/2005/03/01/382756.aspx#385720</link><pubDate>Sat, 05 Mar 2005 06:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:385720</guid><dc:creator>Rico Mariani</dc:creator><description>Be careful now. There is no savings in either the throwing OR the catching. Exceptions always cost you tons. &lt;br&gt;&lt;br&gt;The savings you get are as follows and they're somewhat indirect. &lt;br&gt;&lt;br&gt;Suppose you have exotic failure conditions. In regular code you have to check each one in each place it might happen: if (blah) if (blahblah) if (blahblahblah). Those tests are present even though the failure may never actually happen. You always pay the cost of the test. If you use exceptions you don't have those tests. So you win if the exception doesn't happen or happens very rarely. &lt;br&gt;&lt;br&gt;If the exception happens fairly frequently you LOSE big time. Hence my general rule is, don't use an exception unless the failure happens less than about 1 time in 1000. And more exotic is better still. If the exception is too common then you will lose. &lt;br&gt;&lt;br&gt;See &lt;a target="_new" href="http://weblogs.asp.net/ricom/archive/2003/12/19/44697.aspx"&gt;http://weblogs.asp.net/ricom/archive/2003/12/19/44697.aspx&lt;/a&gt; Remove Comment 385718 </description></item><item><title>re: Common Sources of Processor Performance Penalties: Five Issues</title><link>http://blogs.msdn.com/ricom/archive/2005/03/01/382756.aspx#390137</link><pubDate>Wed, 09 Mar 2005 06:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:390137</guid><dc:creator>Shawn O'Keef</dc:creator><description>&amp;quot;In constrast I've yet to observe locality problems attributable to the GC.&amp;quot;&lt;br&gt;&lt;br&gt;This is less true if your heap is not in a contiguous space. &lt;br&gt;</description></item></channel></rss>