Skip to content

Commit b151223

Browse files
danmoseleygewarren
andauthored
Guidance for AggressiveInlining and AggressiveOptimization (#9188)
* wording * typo * Apply suggestions from code review Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --------- Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
1 parent 6b28329 commit b151223

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

xml/System.Runtime.CompilerServices/MethodImplOptions.xml

+6-4
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@
116116
</ReturnValue>
117117
<MemberValue>256</MemberValue>
118118
<Docs>
119-
<summary>The method should be inlined if possible.</summary>
119+
<summary>
120+
<para>The method should be inlined if possible.</para>
121+
<para>Unnecessary use of this attribute can reduce performance. The attribute might cause implementation limits to be encountered that will result in slower generated code. Always measure performance to ensure it's helpful to apply this attribute.</para>
122+
</summary>
120123
</Docs>
121124
</Member>
122125
<Member MemberName="AggressiveOptimization">
@@ -148,9 +151,8 @@
148151
<MemberValue>512</MemberValue>
149152
<Docs>
150153
<summary>
151-
<para>The method contains code that should always be optimized by the just-in-time (JIT) compiler.</para>
152-
<para>Use this attribute if running an unoptimized version of the method has undesirable effects, for instance causing too much overhead or extra memory allocation.</para>
153-
<para>Methods with this attribute may not have optimal code generation. They bypass the first tier of <a href="/dotnet/core/runtime-config/compilation#tiered-compilation">Tiered Compilation</a> and therefore can't benefit from optimizations that rely on tiering, for example, <a href="/dotnet/core/runtime-config/compilation#profile-guided-optimization">Dynamic PGO</a> or optimizations based on initialized classes.</para>
154+
<para>The method contains code that should always be optimized for performance.</para>
155+
<para>It's rarely appropriate to use this attribute. Methods that apply this attribute bypass the first tier of <a href="/dotnet/core/runtime-config/compilation#tiered-compilation">tiered compilation</a> and therefore don't benefit from optimizations that rely on tiered compilation. Those optimizations include <a href="/dotnet/core/runtime-config/compilation#profile-guided-optimization">dynamic PGO</a> and optimizations based on initialized classes. Use of this attribute might also increase memory use. Always measure performance to ensure it's helpful to apply this attribute.</para>
154156
</summary>
155157
</Docs>
156158
</Member>

0 commit comments

Comments
 (0)