I’m trying to compile Python 3.6 on an arm based Linux machine,
./configure outputs this:
If you want a release build with all optimizations active (LTO, PGO, etc),
This flag enables Profile guided optimization (PGO) and Link Time Optimization (LTO).
Both are expensive optimizations that slow down the build process but yield a significant speed boost (around 10-20% from what I remember reading).
The discussion of what these exactly do is beyond my knowledge and probably too broad for a single question. Either way, you can read a bit about LTO from the the docs on GCC which has an implementation for it and get a start on PGO by reading its wiki page.
Also, see the relevant issues opened on the Python Bug Tracker that added these:
- Issue 24915: Profile Guided Optimization improvements (better training, llvm support, etc) (Added PGO.)
- Issue 25702: Link Time Optimizations support for GCC and CLANG (Added LTO.)
- Issue 26359: CPython build options for out-of-the box performance (Adds the
--enable-optimizationsflag to the configure script which enables the aforementioned optimizations.)
As pointed out by @Shuo in a comment and stated in Issue 28032, LTO isn’t always enabled with the
--enable-optimizations flag. Some platforms (depending on the supported version of
gcc) will disable it in the configuration script.
Future versions of this flag will probably always have it enabled though, so it’s pretty safe to talk about them both here.