Skip to content

Two-stage PGO and BOLT workflow for GCC and Clang, covering instrumented builds, profile collection, and post-link optimisation.

CCM score
62 of 100
skills.sh installs
695
GitHub stars
303
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers when PGO pays off, GCC and Clang instrumented and optimised build workflows, and Clang SamplePGO without instrumentation overhead
  • Includes a CMake integration with PGO_INSTRUMENT and PGO_USE options plus a two-phase build script for profile collection and optimised rebuild
  • Provides BOLT post-link steps with perf2bolt, llvm-bolt instrumentation, and -reorder-blocks=ext-tsp and -reorder-functions=cdsort layout options
  • Designed for C/C++ teams that have already applied -O3 and -march=native and need further runtime gains

Install

$ npx -y skills add mohitmishra786/low-level-dev-skills --skill pgo -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

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-generate and -fprofile-use?"
  • "My -O3 build 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

Details

Repository
github.com/mohitmishra786/low-level-dev-skills
First seen
Jun 3, 2026

Questions

What is the PGO skill for C/C++ and what does it cover?

The pgo skill guides agents through the full profile-guided optimization workflow for C and C++ with GCC and Clang. It covers instrumented builds, collecting representative workload profiles, optimized rebuilds, and BOLT post-link optimization.

When should I use profile-guided optimization?

Use it when runtime performance plateaus after -O3 and -march=native are applied, especially for branch-heavy code or code with irregular call patterns. The skill notes that large binaries such as compilers, databases and servers tend to benefit most.

How do I install the pgo skill?

Run npx -y skills add mohitmishra786/low-level-dev-skills --skill pgo -y in your project. The agent then gains guidance for building, profiling and optimizing C or C++ binaries with PGO and BOLT.

How does BOLT differ from PGO?

BOLT reorders functions and basic blocks in the final linked binary using profile data to improve instruction cache locality, and it is applied after PGO. The skill describes it as adding roughly 5-15% more performance on top of a PGO build.

More from mohitmishra786/low-level-dev-skills

All 54

Similar to Pgo