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.
Related videos on Youtube
Author by
Yann Lebel
Updated on June 04, 2022Comments
-
Yann Lebel about 2 years
What is the difference between the MethodImplAttribute with the option
MethodImplOptions.AggressiveInlining
and theTargetedPatchingOptOut
?When I searched on Google everybody seems to says that both (might) inline the method but without giving the difference.
-
Feidex over 11 yearsTargetedPatchingOptOut 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 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 over 10 yearsAs mentioned above, don't apply TargetedPatchingOptOut in your own code - see stackoverflow.com/a/14982340/94078