<?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>Jit Optimizations: Inlining (II)</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx</link><description>In a JIT compiler, inlining can become an expensive optimization (compile time wise): it can involve loading other classes or assemblies, doing security checks, etc... What's worse, even after doing all this expensive work, you may find out that the candidate</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Jit Optimizations: Inlining (II)</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#250409</link><pubDate>Mon, 01 Nov 2004 10:13:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:250409</guid><dc:creator>Luc Cluitmans</dc:creator><description>Thanks again for your insightful post!&lt;br&gt;&lt;br&gt;Quote: &amp;quot;We don't inline across virtual calls.&amp;quot;&lt;br&gt;&lt;br&gt;I see the reason for this for general virtual calls, but does it also apply to 'virtual' calls in *sealed* classes? Or virtual calls that are 'sealed' in another way, e.g. sealing the method itself, if the highlevel language supports that (C# supports sealing a method). After all, because those methods are sealed, they can be resolved at compile/JIT time for 100% of the cases, so they are not truly 'virtual' anymore.&lt;br&gt;&lt;br&gt;</description></item><item><title>re: Jit Optimizations: Inlining (II)</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#250458</link><pubDate>Mon, 01 Nov 2004 12:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:250458</guid><dc:creator>Hallvard Vassbotn</dc:creator><description>&amp;gt;  really good candidate for inlining is a &lt;br&gt;&amp;gt; property getter/setter.&lt;br&gt;&lt;br&gt;Yes, but...&lt;br&gt;&lt;br&gt;&amp;gt; MarshalByRef classes won't be inlined&lt;br&gt;&lt;br&gt;This means that all component and WinForm code have inline disabled. &lt;br&gt;&lt;br&gt;IMO, it was a mistake to have System.ComponentModel.Component inherit from System.MarshalByRef. In 99.99% of the cases, you *don't* want to control a component or WinForm remotely, so why add the overhead for all those cases? &lt;br&gt;&lt;br&gt;There should probably have been a separete treee for RemotableComponent instead. Could you consider an per-class attribute to turn off the remotablity of a MarshalByRef inherited class, to enable shortcuts and optimizations such as inlining?</description></item><item><title>re: Jit Optimizations: Inlining (II)</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#250503</link><pubDate>Mon, 01 Nov 2004 14:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:250503</guid><dc:creator>Patrick</dc:creator><description>Totally agreed on the MarshalByRef for WinForms, I still haven't seen a good explanation as to why this decision was made.  Hopefully David can fill us in here...</description></item><item><title>re: Jit Optimizations: Inlining (II)</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#250537</link><pubDate>Mon, 01 Nov 2004 17:33:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:250537</guid><dc:creator>Dmitriy Zaslavskiy</dc:creator><description>&amp;gt; There have been suggestions for us adding an attribute to control these thresholds.&lt;br&gt;Why add something so specific why not provide a set of hints that compilers (or even people) that compiler can add to inform JIT about priorities. JIT will always have those limitations and compilers can spare some time.&lt;br&gt;So you would be able apply (just a hint) a InlineMethod and maybe even mark regions of the code as seldom executed. &lt;br&gt;Other hints or compiler relaxation might be to say that arrays do not need to support covariance. &lt;br&gt;&lt;br&gt;As always could you please also comment on how inlining is effected by NGEN and how inlining is effected by Generics. Please correct my assumption: if type parameter is constrained to IFoo with method f() and let's say the method satisfies the requirements you mention above. it seems to me that for T : struct inline will be done but not for a class.&lt;br&gt;&lt;br&gt;Dmitriy&lt;br&gt;</description></item><item><title>re: Jit Optimizations: Inlining (II)</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#250584</link><pubDate>Mon, 01 Nov 2004 18:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:250584</guid><dc:creator>David Notario</dc:creator><description>Luc: You are right, we could be smarter for sealed classes, we currently aren't using the sealed attribut to get advantage here.&lt;br&gt;&lt;br&gt;Hallvard: In v1.0 and v1.1 we didn't inline any MBR call, so yes, that means that we wouldnt inline Windows.Forms code, we are better in Whidbey in this respect.&lt;br&gt;&lt;br&gt;As about why Windows.Forms is MBR, this is something I digged up from Brad Abram's Blog:&lt;br&gt;&lt;br&gt;&amp;quot;Our preference would be for it to not be Marshal By Ref, but because it is hosted via com cross domain in IE, we needed to make it mbro in order for the com calls to marshal to the com apartment&amp;quot;&lt;br&gt;&lt;br&gt;Dmitry: &lt;br&gt;&lt;br&gt;I dont remember offhand any different behavior between inlining in the JIT and NGEN (they use the same compiler). For generics, I would say it's the other way around, you have more possibilities of getting the inlining right if T is a class, and not a struct&lt;br&gt;</description></item><item><title>re: Jit Optimizations: Inlining (II)</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#250594</link><pubDate>Mon, 01 Nov 2004 19:08:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:250594</guid><dc:creator>Dmitriy Zaslavskiy</dc:creator><description>David, could you explain.&lt;br&gt;If T is a class you share the code for all such Ts how would you then inline?&lt;br&gt;If T is a struct you are generating a different code for each T so inlining seems to be possible.&lt;br&gt;&lt;br&gt;</description></item><item><title>re: Jit Optimizations: Inlining (II)</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#250815</link><pubDate>Tue, 02 Nov 2004 01:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:250815</guid><dc:creator>Dmitriy Zaslavskiy</dc:creator><description>David, &lt;br&gt;  I thought v2 of ngen is doing more work than JIT.</description></item><item><title>re: Jit Optimizations: Inlining (II)</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#251012</link><pubDate>Tue, 02 Nov 2004 13:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:251012</guid><dc:creator>Hallvard Vassbotn</dc:creator><description>&amp;gt;Hallvard: In v1.0 and v1.1 we didn't inline any MBR call, so yes, that means that we wouldnt inline Windows.Forms code, we are better in Whidbey in this respect. &lt;br&gt;&lt;br&gt;Ok, thanks for the info. Do you have any specifics on this? Maybe a new blog post?&lt;br&gt;&lt;br&gt;&amp;quot;hosted via com cross domain in IE, we needed to make it mbro&amp;quot;&lt;br&gt;&lt;br&gt;Yuck - sounds like a hack... ;) &lt;br&gt;&lt;br&gt;</description></item><item><title>re: Jit Optimizations: Inlining (II)</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#251426</link><pubDate>Wed, 03 Nov 2004 07:27:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:251426</guid><dc:creator>Kirk Ferdmann</dc:creator><description>David,&lt;br&gt;I tried to estimate how many calls will actually get inlined. So I compiled the following code to see if g will get inlined:&lt;br&gt;&lt;br&gt;namespace Test&lt;br&gt;{&lt;br&gt;    class C&lt;br&gt;    {&lt;br&gt;        public void g () {}&lt;br&gt;        public void f () { g (); }&lt;br&gt;    }&lt;br&gt;    class Class1&lt;br&gt;    {&lt;br&gt;        [STAThread]&lt;br&gt;        static void Main ( string [] args )&lt;br&gt;        {&lt;br&gt;            C c = new C ();&lt;br&gt;            c.f ();&lt;br&gt;        }&lt;br&gt;    }&lt;br&gt;}&lt;br&gt;&lt;br&gt;- g is much smaller then 32 bytes, &lt;br&gt;- the call is not virtual, &lt;br&gt;- no value types are involved,&lt;br&gt;- it's not marshalled by ref,&lt;br&gt;- no loops, no complex flow,&lt;br&gt;- the code is in the same assembly so no VM restrictions shall apply.&lt;br&gt;&lt;br&gt;Yet the call is not inlined. I understand that your list does not cover all possible cases. Just curious what is the reason in such seemingly trivial one?</description></item><item><title>re: Jit Optimizations: Inlining (II)</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#251720</link><pubDate>Wed, 03 Nov 2004 19:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:251720</guid><dc:creator>David Notario</dc:creator><description>Kirk, I suspect that you are looking at debug code (looking at the code under VS?, it always tells the jit not to optimize), this is what we generate with optimized code:&lt;br&gt;&lt;br&gt;mov     ECX, 0x3c10f60&lt;br&gt;call    CORINFO_HELP_NEWSFAST&lt;br&gt;ret</description></item><item><title>re: Jit Optimizations: Inlining (II)</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#252048</link><pubDate>Thu, 04 Nov 2004 04:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:252048</guid><dc:creator>Kirk Ferdmann</dc:creator><description>David, that was indeed the case. Using cordbg with JitOptimizations set to 1 helps. BTW in my case cordbg shows just a number instead of CORINFO_HELP_NEWSFAST. I could not figure out how to fix that.</description></item><item><title>re: Jit Optimizations: Inlining (II)</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#252548</link><pubDate>Fri, 05 Nov 2004 01:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:252548</guid><dc:creator>Kirk Ferdmann</dc:creator><description>Another comment: it appears that that you guys inline virtual call after all. You don't inline calls to virtual methods. But a callvirt to non-virtual method (rather common in C# case) may get inlined.</description></item><item><title>Interesting Findings today</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#253136</link><pubDate>Sat, 06 Nov 2004 03:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:253136</guid><dc:creator>Jason Haley</dc:creator><description>Interesting Findings today</description></item><item><title>When will structs be properly inlined</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#271060</link><pubDate>Sun, 28 Nov 2004 04:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:271060</guid><dc:creator>Rüdiger Klaehn</dc:creator><description>When will the inlining of structs issue be resolved? This is very important for many situations such as the various structs in the DirectX namespaces (Vectors!), System.Drawing etc. and for scientific computing.&lt;br&gt;&lt;br&gt;I have filed a suggestion here: &lt;br&gt;&amp;lt;&lt;a target="_new" href="http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=fb7b3c93-a9e9-418b-85b3-b67a195c7e1a&amp;gt;"&gt;http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=fb7b3c93-a9e9-418b-85b3-b67a195c7e1a&amp;gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;and as you can see I am not the only one worrying about this. </description></item><item><title>Caveats about System.Diagnostics.StackTrace</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#400811</link><pubDate>Wed, 23 Mar 2005 07:34:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:400811</guid><dc:creator>Mike Stall's .NET Debugging Blog</dc:creator><description /></item><item><title>JIT performance affected by C# v3</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#467568</link><pubDate>Thu, 15 Sep 2005 16:22:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:467568</guid><dc:creator>C# Nuggets</dc:creator><description /></item><item><title>Tech-Ed : Day 4</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#632127</link><pubDate>Thu, 15 Jun 2006 15:20:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:632127</guid><dc:creator>Mathoms</dc:creator><description /></item><item><title>JIT Optimizations, Inlining, and Interface Method Dispatching (Part 1 of N)</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#1770401</link><pubDate>Tue, 27 Feb 2007 23:06:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1770401</guid><dc:creator>All Your Base Are Belong To Us</dc:creator><description>&lt;p&gt;The .NET Just-In-Time Compiler (JIT) is considered by many to be one of the primary performance advantages&lt;/p&gt;
</description></item><item><title>El Inlining</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#4677434</link><pubDate>Sat, 01 Sep 2007 01:31:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4677434</guid><dc:creator>vtortola</dc:creator><description>&lt;p&gt;A menudo al hablar de optimizaci&amp;#243;n de c&amp;#243;digo se habla del inlining ( c&amp;#243;digo en l&amp;#237;nea ) como t&amp;#233;cnica de&lt;/p&gt;
</description></item><item><title>Release IS NOT Debug: 64bit Optimizations and C# Method Inlining in Release Build Call Stacks</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#5678812</link><pubDate>Thu, 25 Oct 2007 23:48:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5678812</guid><dc:creator>ASPInsiders</dc:creator><description>&lt;p&gt;Just a reminder: Release builds are not Debug builds. Seems obvious, but it's worth saying again. Release&lt;/p&gt;
</description></item><item><title>Scott Hanselman's Computer Zen - Release IS NOT Debug: 64bit Optimizations and C# Method Inlining in Release Build Call Stacks</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#5703413</link><pubDate>Sat, 27 Oct 2007 08:35:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5703413</guid><dc:creator>Scott Hanselman's Computer Zen - Release IS NOT Debug: 64bit Optimizations and C# Method Inlining in Release Build Call Stacks</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.hanselman.com/blog/ReleaseISNOTDebug64bitOptimizationsAndCMethodInliningInReleaseBuildCallStacks.aspx"&gt;http://www.hanselman.com/blog/ReleaseISNOTDebug64bitOptimizationsAndCMethodInliningInReleaseBuildCallStacks.aspx&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>.Net Performance pointers</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#8202250</link><pubDate>Fri, 14 Mar 2008 15:33:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8202250</guid><dc:creator>Dotmad (on .Net)</dc:creator><description>&lt;p&gt;After going this week to the Microsoft performance open house , here are few things to consider: Create&lt;/p&gt;
</description></item><item><title>Open Source Is The Root Of All Evil</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#9555923</link><pubDate>Mon, 20 Apr 2009 00:25:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9555923</guid><dc:creator>A Generic Collection</dc:creator><description>&lt;p&gt;Open Source Is The Root Of All Evil&lt;/p&gt;
</description></item><item><title>
	A Generic Collection | Inlining in C#
</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#9555958</link><pubDate>Mon, 20 Apr 2009 01:04:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9555958</guid><dc:creator>
	A Generic Collection | Inlining in C#
</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.agenericcollection.com/post/Inlining-in-C.aspx"&gt;http://www.agenericcollection.com/post/Inlining-in-C.aspx&lt;/a&gt;&lt;/p&gt;
</description></item><item><title> David Notario s WebLog Jit Optimizations Inlining II | work from home</title><link>http://blogs.msdn.com/davidnotario/archive/2004/11/01/250398.aspx#9761446</link><pubDate>Tue, 16 Jun 2009 15:25:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9761446</guid><dc:creator> David Notario s WebLog Jit Optimizations Inlining II | work from home</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://workfromhomecareer.info/story.php?id=12051"&gt;http://workfromhomecareer.info/story.php?id=12051&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>