Tiered Compilation allows the .NET runtime to substitute different assembly code method implementations for the same method during the lifetime of an application to achieve higher performance. It currently achieves this in the following two ways.
The tiered compilation (TC) is on by default with .NET Core 3.0. This feature enables the runtime to adaptively use the just-in-time (JIT) compiler to achieve better performance.
The main benefit of tiered compilation is to provide two ways of jitting methods.
The quality refers to how well the method is optimized. TC helps to improve an application's performance as it goes through various stages of execution, from startup through the steady-state.
When the tiered compilation is disabled, every method is compiled in a single way that is biased to steady-state performance over startup performance.
When the tiered compilation is enabled, the following behavior applies for method compilation when an app starts.
ReadyToRun
, the pregenerated code is used.MethodImplOptions.AggressiveOptimization
, the fully optimizing JIT is used.For frequently called methods, the just-in-time compiler eventually creates fully optimized code in the background. The optimized code then replaces the pre-compiled code for that method.
Code generated by Quick JIT may run slower, allocate more memory, or use more stack space. If there are issues, you can disable Quick JIT using this MSBuild property in the project file:
<PropertyGroup>
<TieredCompilationQuickJit>false</TieredCompilationQuickJit>
</PropertyGroup>
To disable TC completely, use this MSBuild property in your project file:
<PropertyGroup>
<TieredCompilation>false</TieredCompilation>
</PropertyGroup>
If you change these settings in the project file, you may need to perform a clean build for the new settings to be reflected (delete the obj and bin directories and rebuild).