# Profile-guided optimization in Go

DevFeed: [Profile-guided optimization in Go](<https://devfeed.tech/articles/profile-guided-optimization-in-go-29420.md>)

Original publisher: [Read original article](<https://lemire.me/blog/2026/08/09/profile-guided-optimization-in-go/>)

Author: Daniel Lemire

Published: 2026-08-09T23:17:36Z

Content type: article

Language: en

Sources: [Daniel Lemire](<https://devfeed.tech/sources/daniel-lemire.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Optimization](<https://devfeed.tech/topics/optimization.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [inlining](<https://devfeed.tech/topics/inlining.md>), [JSON](<https://devfeed.tech/topics/json.md>)

Tags: [compiler](<https://devfeed.tech/tags/compiler.md>), [cpu](<https://devfeed.tech/tags/cpu.md>), [go](<https://devfeed.tech/tags/go.md>), [inlining](<https://devfeed.tech/tags/inlining.md>), [interface](<https://devfeed.tech/tags/interface.md>), [json](<https://devfeed.tech/tags/json.md>), [measurement](<https://devfeed.tech/tags/measurement.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [profile](<https://devfeed.tech/tags/profile.md>), [profiling](<https://devfeed.tech/tags/profiling.md>), [speed](<https://devfeed.tech/tags/speed.md>), [standard-library](<https://devfeed.tech/tags/standard-library.md>), [systems](<https://devfeed.tech/tags/systems.md>)

## AI overview

This article explains how profile-guided optimization in Go uses runtime measurements to guide compiler decisions such as inlining hot call sites and devirtualizing interface calls. It also describes a benchmark parsing three JSON documents with separately trained PGO builds and comparing their speed against a profile-free baseline.

## Source excerpt

When a compiler optimizes your program, it has to guess. Which functions are worth inlining? Which side of a branch is the common one? Which method does this interface call actually reach? At compile time it cannot know, so it uses heuristics. Profile-guided optimization (PGO) replaces the guessing with measurement: you run your program, record ... Continue reading Profile-guided optimization in Go