ReadyToRun & Tiered Compilation
Understand ReadyToRun pre-compilation, tiered JIT compilation, and PGO (profile-guided optimization) in .NET.
JIT, R2R, and Tiered Compilation
.NET uses several compilation strategies to balance startup speed with peak throughput. Understanding JIT, ReadyToRun, and Tiered Compilation helps you choose the right settings for your workload.
How the JIT Works
The Just-in-Time (JIT) compiler converts IL bytecode to native machine code the first time each method is called. This adds latency to the first invocation but produces highly optimized code for the running machine.
// What happens at runtime:
// 1. App starts — methods are stubs pointing to the JIT
// 2. First call to MyMethod() → JIT compiles IL → native x64 code
// 3. Subsequent calls → native code runs directly (no JIT overhead)
// Startup cost: each method's first call takes microseconds for JIT
// Peak performance: excellent — JIT knows the actual CPU features
// .NET 9 JIT optimizations applied automatically:
// - Inlining
// - Loop unrolling
// - Escape analysis
// - SIMD vectorization
// - Profile-Guided Optimization (PGO)All lessons in this course
- Native AOT Compilation
- Trimming & Reflection Limitations
- ReadyToRun & Tiered Compilation
- Benchmarking with BenchmarkDotNet