Home / Companies / Grafana Labs / Blog / Post Details
Content Deep Dive

How to use PGO and Grafana Pyroscope to optimize Go applications

Blog post from Grafana Labs

Post Details
Company
Date Published
Author
Ryan Perry
Word Count
1,339
Company Posts That Month
25
Language
English
Hacker News Points
-
Post removed?
No
Summary

Profile-guided optimization (PGO) is a compiler feature that leverages runtime profiling data to enhance the performance of Go applications by optimizing code through inlining and devirtualization. Now fully integrated into Go 1.21, PGO can be significantly enhanced using Grafana Pyroscope, an open-source continuous profiling database. Inlining involves replacing function calls with their bodies to eliminate overhead, while devirtualization optimizes interface calls into direct function calls, both improving execution efficiency based on real usage patterns. To utilize PGO with Pyroscope, developers can build an initial Go binary with profiling enabled, collect runtime profiles, query for optimal PGO data using Pyroscope's profilecli tool, and apply the PGO file during the build process. Real-world applications have shown performance improvements of 2-7% using PGO, with the potential for further gains as future versions of Go incorporate additional optimizations. This process can be implemented with Grafana Pyroscope or Grafana Cloud Profiles, providing valuable performance enhancements with minimal downsides.

Trends Found in this Post

No tracked trend matches for this post yet.

Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.