The basics of Profile-Guided Optimization (PGO) in Rust
summary
Shows concrete PGO wins and failures: applying instrumentation PGO and sampling PGO with LLVM tools (llvm-profdata, perf/Intel LBR) yields measured speedups on real workloads, but instrumented binaries can bloat and sometimes slow extreme hot loops (one ClickHouse run slowed ~300×), while sampling gives ~80–90% of instrumentation’s benefit at ~2% runtime overhead. Covers tooling like cargo-pgo, hardware limits (LBR/BSR, no hypervisor support), profile skew, reproducibility issues, an LTO+PGO LLVM bug, and WebAssembly lack of support.
AI-written summary · about
chapters (19)
- 0:00Profile-Guided Optimization basics
- 3:18Ahead-of-Time vs Just-in-Time compilation
- 5:45What is PGO
- 7:51How PGO optimizes code
- 8:12Instrumentation vs Sampling PGO
- 10:19Instrumentation PGO caveats
- 12:27How Sampling PGO works
- 15:19Sampling PGO limitations
- 17:49PGO traps and mitigations
- 21:03Collecting PGO profiles
- 23:34Rust compiler PGO support
- 25:21PGO issues in Rust
- 26:47PGO across languages
- 27:29PGO tools for Rust
- 28:30PGO in Rust ecosystem
- 29:12Good PGO candidates
- 30:15PGO optimization roadmap
- 31:18PGO resources
- 31:59Q&A
related talks
30mProfile-Guided Optimization (PGO) in Rust: unknown parts
29mEmpirical Observations about Profile-Guided Optimizations for Mainstream C/C++ Compilers
06mProfile-Guided Optimization in the Go Compiler
22mProfile Inference Revisited
23m"The Current State and Future of Rust Compiler Performance"
59mParallel Programming in Rust: Techniques for Blazing Speed
27mImproving Rust Performance Through Profiling and Benchmarking
24mRust performance debugging with TUIs and LLMs
