GopherCon 2022: Profile-Guided Optimization in the Go Compiler - Jin Lin @GopherAcademy
GopherCon 2022: Profile-Guided Optimization in the Go Compiler - Jin Lin  @GopherAcademy
Uploaded December 2023 | Updated December 2026, 3 days ago
Inefficiencies in Go programs can be isolated via profiling tools such as pprof and linux profiler perf. Such tools can pinpoint source code regions where most of the execution time is spent. Unlike other optimizing compilers such as LLVM, the Go compiler does not yet perform Profile-Guided Optimization(PGO). PGO uses information about the code’s runtime behavior to guide compiler optimizations such as inlining, code layout, etc. PGO can improve application performance in the range of 15-30% [LLVM]. In this Lightning Talk, we extend the Go compiler with PGO. Specifically, we incorporate the profiles into the compiler frontend, backend, and linker to perform profile-guided inlining, code specialization, basic block layout, and function reordering optimizations. The format of the profile file consumed by our PGO is identical to the protobuf format produced by the pprof tool. This format is rich enough to carry additional hardware performance counter information.

The first version of the code that performs profile-guided inlining is being upstreamed to Go at go-review.googlesource.com/c/go/+/429863 and the proposal is at go-review.googlesource.com/c/proposal/+/430398/2/design/55025-pgo-design.md
GopherCon 2022: Profile-Guided Optimization in the Go Compiler - Jin LinGopherCon 2024: Build A Glamorous Habit Tracker Using Charm CLI - Donia ChaiehloudjGopherCon 2025: Advancing Go Garbage Collection with Green Tea - Michael KnyszekGopherCon 2021: Patterns to Build Scalable APIs at FOX - Amit MishraGopherCon 2021: Go Team Ask Me Anything - Go Time LiveGopherCon 2021: Northwesterns Data Science Program Features Go - Tom MillerGopherCon 2023: Teaching and Learning with Go: The Northwestern Experience - Thomas MillerGopherCon 2024: Range Over Function Types - Ian Lance TaylorGopherCon 2023: ‘Tis But a Scratch: Shrinking Container Images using FROM scratch - Thomas EckertGopherCon 2023: Idiomatic Go Tells a Story - Kaylyn GibilterraGopherCon 2022: Soft Memory Limit in Go 1.19 - Tarun PothulapatiGopherCon 2024: Implementing Code Coverage with -toolexec - Ehden Sinai
Gopher Academy |

GopherCon 2022: Profile-Guided Optimization in the Go Compiler - Jin Lin

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER