.NET › CLR & Runtime
What is tiered compilation, and how does it balance fast startup with peak execution performance?
AdvancedAnswer
Tiered compilation JIT-compiles a method quickly with minimal optimization on its first call (Tier 0, fast to produce but slower to execute), then, if the method is called frequently enough (a 'hot' method), the CLR recompiles it in the background with full optimizations (Tier 1) and seamlessly swaps in the optimized version -- balancing fast application startup (avoiding expensive full optimization for rarely-called methods) against long-term throughput (ensuring frequently-executed hot paths eventually get maximally optimized code).
<PropertyGroup>
<TieredCompilation>true</TieredCompilation> <!-- default: true -->
<TieredPGO>true</TieredPGO> <!-- dynamic profile-guided optimization, default: true in modern .NET -->
</PropertyGroup>Real-world example A web application's startup time improved noticeably after upgrading to a .NET version with better tiered compilation defaults, since most request-handling code initially runs at Tier 0 speed, with only genuinely hot paths eventually promoted to fully optimized Tier 1 code.