Optimize C++ with PGO and Google Benchmark
Who is this for?
Developers looking to optimize C++ performance based on runtime behavior with profile-guided optimization (PGO).
What will you learn?
After completing this Learning Path, you'll be able to perform the following tasks:
- Microbenchmark a function using Google Benchmark.
- Apply profile-guided optimization to build performance-tuned binaries.
Prerequisites
Before starting, you'll need the following prerequisites:
- Basic C++ understanding
- Access to an Arm-based Linux machine, such as an AWS Graviton-based instance or an Arm AGI CPU platform
Summary
This summary was drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.
You’ll apply profile-guided optimization (PGO) to a C++ microbenchmark on an Arm-based Linux system with Google Benchmark. You’ll build an instrumented binary with
-fprofile-generate, run it to create .gcda files, and recompile with -fprofile-use. You’ll compare benchmark timings before and after PGO, inspect the generated artifacts, and integrate PGO into either a Makefile or a continuous integration Github Actions workflow.