C# & CLR Internals (50 Qs)•Part 3: CLR Internals, Native AOT & Production Diagnostics (25 - 35)
How does Tiered Compilation and Dynamic PGO (Profile-Guided Optimization) work in .NET 8/9?
senior LevelPerformance
In Simple Words:
- Tier 0: Methods are compiled quickly with no optimizations for fast application startup.
- Tier 1: As methods exceed call thresholds, the JIT re-compiles them with full optimizations.
- Dynamic PGO: The JIT injects lightweight instrumentation into Tier 0 code to observe runtime behavior (e.g., concrete types in interfaces). In Tier 1, it performs devirtualization, turning interface calls into direct non-virtual method calls and inlining them.