Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Profile Guided Optimization Comes to .NET Core

Profile Guided Optimization Comes to .NET Core

Profile Guided Optimization (PGO) is a native compilation technology used to generate more highly optimized code.  It accomplishes this through a two-step compilation process-- using a first step to record information about execution then a second step that uses that information to build an improved binary.  According to Microsoft's Daniel Podder and Bertrand Le Roy, the historic benefit realized from this process is an improvement in laying out a binary's code in the image which results in better working and reference set locality.

A strong reason to implement PGO in .NET Core is that users do not need to take any special actions to benefit from PGO as it is applied to the .NET Core runtime and JIT compiler.  Consequently managed applications will automatically benefit although exact improvements depend on a given application and its usage.

For this release, Podder and Le Roy state that PGO optimizations have been applied to the native parts of the .NET Core runtime, but in the future these optimizations will be made to the managed components of the .NET Core stack . Unlike the PGO optimizations released for .NET Core 1.1 which were Windows x86 only, these latest optimizations have been expanded to include Windows x64 and Linux x64.

Since more than 75% of an .NET Core application's startup time was spent in coreclr.dll and clrjit.dll (on Linux these are and, that is where the team sought to measure and then improve performance.  Based on Microsoft's benchmarks, significant improvement was made on the Windows platform (both x64 & x86) ranging from 14% to 23%.  On the other hand, improvements for Linux x64 ranged from 2% to 5%.  While it is important to see that Linux did not regress with PGO enabled, it also indicates room remains for greater improvements in the future.

According to a Microsoft’s spokesperson, Windows and Linux are considered key deployment targets and as such were positioned to receive PGO technology first.  Additional platforms such as macOS will be considered in the future based on user feedback. 

Rate this Article