Profile Guided Optimization (PGO) with PHP

DevNest
5 min readFeb 6, 2023

In the following article we will explore the use of Profile Guided Optimization (PGO) with PHP and the benefits it can bring to your application.

I will walk you through the following steps:

  • Compile PHP without PGO and profile a basic Symfony installation
  • Compile PHP with PGO and profile a basic Symfony installation

Whether you are a developer looking to optimize your PHP application or simply interested in learning more about performance optimization techniques, this article has something for you. Let’s dive in and explore the world of PGO with PHP.

What is Profile Guided Optimization (PGO)?

First of all we need to understand what PGO means. PGO is a technique used to improve the performance of an application by using profile data generated during the application runtime. This technique is often used in compilers to generate optimized code based on the previously gathered profile data. The technique is not strongly linked to PHP, it can be used in various other languages like: C/C++, Java, Python and many others.

Compiling PHP without PGO

Initially we will compile PHP without enabling PGO in order to gather profile information for the PHP application in the current state. For doing so, I will use a development server where I have CentOS 7 installed.

--

--