Run-time configuration options for compilation

Tiered compilation

  • Configures whether the just-in-time (JIT) compiler uses tiered compilation. Tiered compilation transitions methods through two tiers:
    • The first tier generates code more quickly (quick JIT) or loads pre-compiled code (ReadyToRun).
    • The second tier generates optimized code in the background ("optimizing JIT").
  • In .NET Core 3.0 and later, tiered compilation is enabled by default.
  • In .NET Core 2.1 and 2.2, tiered compilation is disabled by default.
  • For more information, see the Tiered compilation guide.
Setting name Values
runtimeconfig.json System.Runtime.TieredCompilation true - enabled
false - disabled
MSBuild property TieredCompilation true - enabled
false - disabled
Environment variable COMPlus_TieredCompilation 1 - enabled
0 - disabled

Examples

runtimeconfig.json file:

{
   "runtimeOptions": {
      "configProperties": {
         "System.Runtime.TieredCompilation": false
      }
   }
}

Project file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TieredCompilation>false</TieredCompilation>
  </PropertyGroup>

</Project>

Quick JIT

  • Configures whether the JIT compiler uses quick JIT. For methods that don't contain loops and for which pre-compiled code is not available, quick JIT compiles them more quickly but without optimizations.
  • Enabling quick JIT decreases startup time but can produce code with degraded performance characteristics. For example, the code may use more stack space, allocate more memory, and run slower.
  • If quick JIT is disabled but tiered compilation is enabled, only pre-compiled code participates in tiered compilation. If a method is not pre-compiled with ReadyToRun, the JIT behavior is the same as if tiered compilation were disabled.
  • In .NET Core 3.0 and later, quick JIT is enabled by default.
  • In .NET Core 2.1 and 2.2, quick JIT is disabled by default.
Setting name Values
runtimeconfig.json System.Runtime.TieredCompilation.QuickJit true - enabled
false - disabled
MSBuild property TieredCompilationQuickJit true - enabled
false - disabled
Environment variable COMPlus_TC_QuickJit 1 - enabled
0 - disabled

Examples

runtimeconfig.json file:

{
   "runtimeOptions": {
      "configProperties": {
         "System.Runtime.TieredCompilation.QuickJit": false
      }
   }
}

Project file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TieredCompilationQuickJit>false</TieredCompilationQuickJit>
  </PropertyGroup>

</Project>

Quick JIT for loops

  • Configures whether the JIT compiler uses quick JIT on methods that contain loops.
  • Enabling quick JIT for loops may improve startup performance. However, long-running loops can get stuck in less-optimized code for long periods.
  • If quick JIT is disabled, this setting has no effect.
  • If you omit this setting, quick JIT is not used for methods that contain loops. This is equivalent to setting the value to false.
Setting name Values
runtimeconfig.json System.Runtime.TieredCompilation.QuickJitForLoops false - disabled
true - enabled
MSBuild property TieredCompilationQuickJitForLoops false - disabled
true - enabled
Environment variable COMPlus_TC_QuickJitForLoops 0 - disabled
1 - enabled

Examples

runtimeconfig.json file:

{
   "runtimeOptions": {
      "configProperties": {
         "System.Runtime.TieredCompilation.QuickJitForLoops": false
      }
   }
}

Project file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TieredCompilationQuickJitForLoops>true</TieredCompilationQuickJitForLoops>
  </PropertyGroup>

</Project>

ReadyToRun

  • Configures whether the .NET Core runtime uses pre-compiled code for images with available ReadyToRun data. Disabling this option forces the runtime to JIT-compile framework code.
  • For more information, see ReadyToRun.
  • If you omit this setting, .NET uses ReadyToRun data when it's available. This is equivalent to setting the value to 1.
Setting name Values
Environment variable COMPlus_ReadyToRun 1 - enabled
0 - disabled