Walks you through the full two-stage PGO workflow for C/C++ projects: instrument your binary, run representative workloads to collect profile data, then rebuild with optimizations tuned to actual runtime behavior. Covers both GCC and Clang approaches, plus BOLT for post-link binary layout optimization when you need that extra 5-15% after PGO. Most useful when standard O3 optimization has plateaued and you're working with branch-heavy code or large binaries like compilers and databases. The CMake integration examples are solid, and the SamplePGO section is handy if you need production profiling without instrumentation overhead. This is what you reach for when performance actually matters and you've exhausted the easy wins.
- skills.sh installs
- 610
- GitHub stars
- 279
- last updated
- Aug 21, 2026
Install
$ npx -y skills add mohitmishra786/low-level-dev-skills --skill pgo --agent claude-codeInstalls into .claude/skills of the current project.
Files
PGO (Profile-Guided Optimisation)
Purpose
Guide agents through the full PGO workflow: instrument build → representative workload → collect profile → optimised build, covering both GCC and Clang, plus BOLT for post-link optimisation.
Triggers
- "How do I use PGO to speed up my binary?"
- "What is profile-guided optimization and when should I use it?"
- "How do I use
-fprofile-generateand-fprofile-use?" - "My
-O3build isn't fast enough — what next?" - "How does BOLT differ from PGO?"
- "How do I collect representative profile data?"
Workflow
1. When to use PGO
Is -O3 -march=native already applied?
no → apply standard optimisation first
yes → is workload branch-heavy or has irregular call patterns?
yes → PGO will likely help 5-30%
no → PGO may not help; profile first with linux-perf
PGO helps most with:
- Large binaries with many cold/hot code paths (compilers, databases, servers)
- Branch-heavy code where static prediction is wrong
- Function call-heavy code where inlining decisions improve with profile data
2. GCC PGO workflow
Sponsors
Details
- Repository
- github.com/mohitmishra786/low-level-dev-skills
- Category
- Debugging
- First seen
- Jun 3, 2026
More from mohitmishra786/low-level-dev-skills
All 54- Interpreters609
- Cargo Workflows608
- Rust Sanitizers Miri604
- Meson603
- Cpp Modules597
- Rust Debugging597
- Hardware Counters590
- Debug Optimized Builds579
- Cpp Templates574
- Rustc Basics567
- Rust Cross565
- Wasm Emscripten559
- Zig Debugging555
- Zig Build System552
- Zig Cross536
- Wasm Wasmtime532
- Zig Cinterop524
- Cmake1.8K
- Static Analysis1.2K
- Gdb1K
- Llvm948
- Sanitizers895
- Core Dumps828
- Linux Perf814
