MethodImplOptions.AggressiveInlining vs TargetedPatchingOptOut

11,120

I was waiting to see if someone else could have a better answer but it seems no.

After I read dtb comment I did a little bit more research and found this http://blogs.microsoft.co.il/blogs/sasha/archive/2012/01/20/aggressive-inlining-in-the-clr-4-5-jit.aspx.

My understanding of this post is that you can apply both attribute AggressiveInlining will remove the in-lining size limit of the method while like dtb said the TargetedPatchingOptOut will allow inlining accross assembly boundaries.

Share:
11,120

Related videos on Youtube

Yann Lebel
Author by

Yann Lebel

Updated on June 04, 2022

Comments

  • Yann Lebel
    Yann Lebel about 2 years

    What is the difference between the MethodImplAttribute with the option MethodImplOptions.AggressiveInlining and the TargetedPatchingOptOut?

    When I searched on Google everybody seems to says that both (might) inline the method but without giving the difference.

    • Feidex
      Feidex over 11 years
      TargetedPatchingOptOut is quite well explained here: stackoverflow.com/questions/6109745 The crucial part seems to be that the inlining is performed across assembly boundaries, which is not done by default. I would expect that AggressiveInlining is a hint to inline the method, but unlike TargetedPatchingOptOut does not allow inlining across assembly boundaries.
    • BlueRaja - Danny Pflughoeft
      BlueRaja - Danny Pflughoeft about 11 years
      @dtb and Yann: See here. tl;dr: inlining across assembly bounds is already done by the JIT for everything but the .Net core library, where TargetedPatchingOptOut is useful. For everyone else (all of us), TargetedPatchingOptOut is completely useless.
  • eug
    eug over 10 years
    As mentioned above, don't apply TargetedPatchingOptOut in your own code - see stackoverflow.com/a/14982340/94078