<?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: C# Inline Methods and Optimization</title>
	<atom:link href="http://www.ademiller.com/blogs/tech/2008/08/c-inline-methods-and-optimization/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ademiller.com/blogs/tech/2008/08/c-inline-methods-and-optimization/?&amp;owa_from=feed&amp;owa_sid=</link>
	<description>Thinking about agile (small 'a') software development, patterns and practices for building Microsoft .NET applications.</description>
	<lastBuildDate>Wed, 10 Mar 2010 23:02:38 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: C# Optimization Revisited Part 3: The &#8220;Native Option&#8221; C++ &#124; #2782 - Thinking about agile (small 'a') software development, patterns and practices for building Microsoft .NET applications.</title>
		<link>http://www.ademiller.com/blogs/tech/2008/08/c-inline-methods-and-optimization/comment-page-1/#comment-1229</link>
		<dc:creator>C# Optimization Revisited Part 3: The &#8220;Native Option&#8221; C++ &#124; #2782 - Thinking about agile (small 'a') software development, patterns and practices for building Microsoft .NET applications.</dc:creator>
		<pubDate>Tue, 01 Sep 2009 17:26:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.ademiller.com/blogs/tech/2008/08/c-inline-methods-and-optimization/#comment-1229</guid>
		<description>[...] Secondly, the serial C++ implementation is much faster than I’d expect when compared to the C# native C++. 4x speedup just seems odd. This suggests that my C# code could be more efficient but this might be at the expense of readability. The C++ code uses macros to modify the BodyNative struct’s data directly whereas the C# code does so through via methods on the Body class. If these method calls aren’t placed inline then this could well be the cause (see previous post on C# and inline methods). [...]</description>
		<content:encoded><![CDATA[<div style="border-left: #bce1f4 5px solid; padding-left: 1em;">
<p>[...] Secondly, the serial C++ implementation is much faster than I’d expect when compared to the C# native C++. 4x speedup just seems odd. This suggests that my C# code could be more efficient but this might be at the expense of readability. The C++ code uses macros to modify the BodyNative struct’s data directly whereas the C# code does so through via methods on the Body class. If these method calls aren’t placed inline then this could well be the cause (see previous post on C# and inline methods). [...]</p>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: C# String Assignment Optimization &#124; #2782 - Agile software development and best practices for building Microsoft .NET applications.</title>
		<link>http://www.ademiller.com/blogs/tech/2008/08/c-inline-methods-and-optimization/comment-page-1/#comment-256</link>
		<dc:creator>C# String Assignment Optimization &#124; #2782 - Agile software development and best practices for building Microsoft .NET applications.</dc:creator>
		<pubDate>Tue, 26 Aug 2008 11:01:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.ademiller.com/blogs/tech/2008/08/c-inline-methods-and-optimization/#comment-256</guid>
		<description>[...] after my performance investigation the other day, got me wondering again. Is there performance really going to be bad? Surely the compiler could [...]</description>
		<content:encoded><![CDATA[<div style="border-left: #bce1f4 5px solid; padding-left: 1em;">
<p>[...] after my performance investigation the other day, got me wondering again. Is there performance really going to be bad? Surely the compiler could [...]</p>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Links For August 21st 2008 &#124; .Net</title>
		<link>http://www.ademiller.com/blogs/tech/2008/08/c-inline-methods-and-optimization/comment-page-1/#comment-254</link>
		<dc:creator>Links For August 21st 2008 &#124; .Net</dc:creator>
		<pubDate>Fri, 22 Aug 2008 05:52:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.ademiller.com/blogs/tech/2008/08/c-inline-methods-and-optimization/#comment-254</guid>
		<description>[...] C# Inline Methods and Optimization Questions on application domains, application pools and unhandled exceptions Did you know… How to [...]</description>
		<content:encoded><![CDATA[<div style="border-left: #bce1f4 5px solid; padding-left: 1em;">
<p>[...] C# Inline Methods and Optimization Questions on application domains, application pools and unhandled exceptions Did you know… How to [...]</p>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ade Miller</title>
		<link>http://www.ademiller.com/blogs/tech/2008/08/c-inline-methods-and-optimization/comment-page-1/#comment-252</link>
		<dc:creator>Ade Miller</dc:creator>
		<pubDate>Thu, 21 Aug 2008 15:32:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.ademiller.com/blogs/tech/2008/08/c-inline-methods-and-optimization/#comment-252</guid>
		<description>Not suppressing JIT optimization will work too, thanks for pointing it out. This gives you the attach debugger behavior all the time which might or might not be what you want.

Thanks!</description>
		<content:encoded><![CDATA[<p>Not suppressing JIT optimization will work too, thanks for pointing it out. This gives you the attach debugger behavior all the time which might or might not be what you want.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: abhishek</title>
		<link>http://www.ademiller.com/blogs/tech/2008/08/c-inline-methods-and-optimization/comment-page-1/#comment-251</link>
		<dc:creator>abhishek</dc:creator>
		<pubDate>Thu, 21 Aug 2008 06:51:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.ademiller.com/blogs/tech/2008/08/c-inline-methods-and-optimization/#comment-251</guid>
		<description>I think insted of doing Ctrl-F5, for doing JIT optimization, even uncheckecking &quot;Supress JIT optimization on module Load&quot;  should also optimize code

http://blogs.msdn.com/saraford/archive/2008/08/13/did-you-know-how-to-optimize-your-code-for-a-build-290.aspx


Regards,</description>
		<content:encoded><![CDATA[<p>I think insted of doing Ctrl-F5, for doing JIT optimization, even uncheckecking &#8220;Supress JIT optimization on module Load&#8221;  should also optimize code</p>
<p><a href="http://blogs.msdn.com/saraford/archive/2008/08/13/did-you-know-how-to-optimize-your-code-for-a-build-290.aspx" rel="nofollow">http://blogs.msdn.com/saraford/archive/2008/08/13/did-you-know-how-to-optimize-your-code-for-a-build-290.aspx</a></p>
<p>Regards,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ade Miller</title>
		<link>http://www.ademiller.com/blogs/tech/2008/08/c-inline-methods-and-optimization/comment-page-1/#comment-250</link>
		<dc:creator>Ade Miller</dc:creator>
		<pubDate>Wed, 20 Aug 2008 17:23:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.ademiller.com/blogs/tech/2008/08/c-inline-methods-and-optimization/#comment-250</guid>
		<description>Hi Eric,

I guess ill thought out (Manager trying to code) concern when I wrote the class was around memcpy overhead. Thinking about it further the Vector is only three doubles so it should be a struct. It &quot;behaves&quot; like an int so it should really be a struct. Time to rewrite it.

In general though it&#039;s interesting to figure out what the compiler(s) are doing under the hood. It might even make me a better programmer one day... maybe.

Thanks</description>
		<content:encoded><![CDATA[<p>Hi Eric,</p>
<p>I guess ill thought out (Manager trying to code) concern when I wrote the class was around memcpy overhead. Thinking about it further the Vector is only three doubles so it should be a struct. It &#8220;behaves&#8221; like an int so it should really be a struct. Time to rewrite it.</p>
<p>In general though it&#8217;s interesting to figure out what the compiler(s) are doing under the hood. It might even make me a better programmer one day&#8230; maybe.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Gunnerson</title>
		<link>http://www.ademiller.com/blogs/tech/2008/08/c-inline-methods-and-optimization/comment-page-1/#comment-249</link>
		<dc:creator>Eric Gunnerson</dc:creator>
		<pubDate>Wed, 20 Aug 2008 16:57:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.ademiller.com/blogs/tech/2008/08/c-inline-methods-and-optimization/#comment-249</guid>
		<description>I think a vector like this is a great place to use a struct.</description>
		<content:encoded><![CDATA[<p>I think a vector like this is a great place to use a struct.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ade Miller</title>
		<link>http://www.ademiller.com/blogs/tech/2008/08/c-inline-methods-and-optimization/comment-page-1/#comment-248</link>
		<dc:creator>Ade Miller</dc:creator>
		<pubDate>Wed, 20 Aug 2008 16:49:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.ademiller.com/blogs/tech/2008/08/c-inline-methods-and-optimization/#comment-248</guid>
		<description>Sasha,

Thanks for pointing this out! It&#039;s a really good post and explains the tradeoffs involved in when to inline and when not to. 

Seems like simple property accessors will almost always be inlined as the inline code (one instruction) is less than the call (five instructions) even with a miltiplier of one:

If InlineSize  &lt;= NonInlineSize * Multiplier do the inlining

Thanks</description>
		<content:encoded><![CDATA[<p>Sasha,</p>
<p>Thanks for pointing this out! It&#8217;s a really good post and explains the tradeoffs involved in when to inline and when not to. </p>
<p>Seems like simple property accessors will almost always be inlined as the inline code (one instruction) is less than the call (five instructions) even with a miltiplier of one:</p>
<p>If InlineSize  &lt;= NonInlineSize * Multiplier do the inlining</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sasha Goldshtein</title>
		<link>http://www.ademiller.com/blogs/tech/2008/08/c-inline-methods-and-optimization/comment-page-1/#comment-247</link>
		<dc:creator>Sasha Goldshtein</dc:creator>
		<pubDate>Wed, 20 Aug 2008 14:06:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.ademiller.com/blogs/tech/2008/08/c-inline-methods-and-optimization/#comment-247</guid>
		<description>There are slight changes in .NET 3.5 SP1 with regard to the x86 JIT&#039;s inlining heuristics.  Vance Morrison covers this well:

http://blogs.msdn.com/vancem/archive/2008/08/19/to-inline-or-not-to-inline-that-is-the-question.aspx</description>
		<content:encoded><![CDATA[<p>There are slight changes in .NET 3.5 SP1 with regard to the x86 JIT&#8217;s inlining heuristics.  Vance Morrison covers this well:</p>
<p><a href="http://blogs.msdn.com/vancem/archive/2008/08/19/to-inline-or-not-to-inline-that-is-the-question.aspx" rel="nofollow">http://blogs.msdn.com/vancem/archive/2008/08/19/to-inline-or-not-to-inline-that-is-the-question.aspx</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
