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-code

Installs 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-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

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

Recommended

More Debugging
1adobe avataraem-replicationadobe/skillsSingle entry point for all AEM 6.5 LTS Replication skills. Covers configuring replication agents, activating/deactivating content, using the Replication API pro604skills.sh installs
2davila7 avatarprompt-engineeringdavila7/claude-code-templatesExpert guide on prompt engineering patterns, best practices, and optimization techniques. Use when user wants to improve prompts, learn prompting strategies, or604skills.sh installs
3withastro avatarastro-developerwithastro/astroComprehensive guide for developing in the Astro monorepo. Covers architecture, debugging, testing, and critical constraints. Use when working on features, fixes596skills.sh installs
4aj-geddes avatardatabase-query-optimizationaj-geddes/useful-ai-promptsImprove database query performance through indexing, query optimization, and execution plan analysis. Reduce response times and database load.593skills.sh installs
5opensearch-project avataropensearch-skillsopensearch-project/opensearch-agent-skillsBuild search applications and query log analytics data with OpenSearch. Use this skill when the user mentions OpenSearch, search app, index setup, search archit593skills.sh installs
6bobmatnyc avatarfastifybobmatnyc/claude-mpm-skillsProduction Fastify (TypeScript) patterns: schema validation, plugins, typed routes, error handling, security hardening, logging, testing with inject, and gracef582skills.sh installs