Skip to content

Guidance for AggressiveInlining and AggressiveOptimization #9188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 15, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions xml/System.Runtime.CompilerServices/MethodImplOptions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@
</ReturnValue>
<MemberValue>256</MemberValue>
<Docs>
<summary>The method should be inlined if possible.</summary>
<summary>
<para>The method should be inlined if possible.</para>
<para>Unnecessary use of this attribute can reduce performance. It may cause implementation limits to be encountered that will cause slower code to be generated. Always measure performance to ensure it is helpful to apply this attribute.</para>
</summary>
</Docs>
</Member>
<Member MemberName="AggressiveOptimization">
Expand Down Expand Up @@ -144,9 +147,8 @@
<MemberValue>512</MemberValue>
<Docs>
<summary>
<para>The method contains code that should always be optimized by the just-in-time (JIT) compiler.</para>
<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>
<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>
<para>The method contains code that should always be optimized for performance.</para>
<para>It is rarely appropriate to use this attribute. Methods that apply this attribute will bypass the first tier of <a href="/dotnet/core/runtime-config/compilation#tiered-compilation">Tiered Compilation</a> and therefore will not benefit from optimizations that rely on tiered compilation, for example, <a href="/dotnet/core/runtime-config/compilation#profile-guided-optimization">Dynamic PGO</a> or optimizations based on initialized classes. It may also increase memory use. Always measure performance to ensure it is helpful to apply this attribute.</para</para>
</summary>
</Docs>
</Member>
Expand Down