A .NET application compiles to Common Intermediate Language (CIL), which does not target a particular processor architecture. Before a processor can execute that code, the CoreCLR compiles it into machine code. Its just-in-time (JIT) compiler does this at runtime, when code is about to be used, rather than compiling the entire application at startup. section 1.5.2
Compiling only needed code avoids the startup cost of compiling everything, but JIT compilation itself takes time. The .NET JIT normally uses tiers: it first produces native code quickly, then recompiles based on how the code behaves under load. Default behavior can change between .NET versions. section 1.5.2 section 10.2
Allow for JIT work in benchmarks
A BenchmarkDotNet comparison of Newtonsoft.Json and System.Text.Json deserialization runs its test methods through pilot and warmup phases before reporting timings. Those phases also give the JIT compiler time to complete, so compilation work is less likely to distort the comparison. Run the benchmark in Release mode. section 10.2
If the target processor and operating system are known, ahead-of-time (AOT) compilation can provide an initial compilation before execution instead. AOT can also trim unused code, but trimming requires thorough testing because it may remove too much. JIT can still be used later for optimization; AOT usage is not developed here. section 1.5.2






