Skip to content

Instantly share code, notes, and snippets.

View daxian-dbw's full-sized avatar
🏠
Working from home

Dongbo Wang daxian-dbw

🏠
Working from home
  • Microsoft
  • Redmond, WA
View GitHub Profile
@EgorBo
EgorBo / Dynamic PGO in .NET 6.0.md
Last active January 25, 2024 15:15
Dynamic PGO in .NET 6.0.md

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?

  1. 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:

  2. Guarded devirtualization - most monomorphic virtual/interface calls can be devirtualized using PGO data, e.g.:

void DisposeMe(IDisposable d)
@tig
tig / F7History.ps1
Last active April 16, 2024 16:07
Use F7 as "Show Command History" in Powershell
# See https://github.com/gui-cs/F7Hisoty which replaces this