How Profile-Guided Optimization Makes Your Code Faster Without Any Code Changes

Stephan Dollberg

60 minute presentation
intermediate
beginner
15:00-16:00, Friday, 2nd July 2021

In this talk we will have a deep dive into Profile-Guided Optimization (PGO) and the assembly level transformations it results in. While PGO has been around for quite a while and is available in all of the major compilers it’s not yet widely used. At the same time it provides great performance benefits without requiring a single code change. It’s also one of the major areas in which compilers get constant improvements across releases. This talk will specifically focus on the GCC implementation though most concepts are similar in other compilers.

We will start by looking at how to deploy PGO and challenges faced while doing so. The main part of this talk will focus on optimizations which the compiler can perform based on PGO instrumentation data, such as function relocation or function splitting. We will compare generated assembly from non-PGO-optimized binaries to PGO-optimized ones. This will be accompanied by measuring the effects of these optimizations based on hardware performance counters and traditional performance measurements.

Stephan Dollberg

Stephan is a Software Engineer at G-Research working on low latency trading systems. He is most passionate about building software that works reliably and fast at the same time.

He mostly codes in C++ but is generally language agnostic. His main areas of interest are in systems engineering, such as concurrency, networking or simply optimizing data structures and algorithms. Favorite data structures are hashmaps.