Dynamic PGO in .NET 6.0
Dynamic PGO (Profile-guided optimization) is a JIT-compiler optimization technique that allows JIT to collect additional information about surroundings (aka profile) in tier0 codegen in order to rely on it later during promotion from tier0 to tier1 for hot methods to make them even more efficient.
What exactly PGO can optimize for us?
Profile-driving inlining - inliner relies on PGO data and can be very aggressive for hot paths and care less about cold ones, see dotnet/runtime#52708 and dotnet/runtime#55478. A good example where it has visible effects is this StringBuilder benchmark:
Guarded devirtualization - most monomorphic virtual/interface calls can be devirtualized using PGO data, e.g.:
void DisposeMe(IDisposable d)