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), please run
./configure --enable-optimizations
.
what does --enable-optimizations
do?
Enable Optimization (-O)Enables maximum performance at run time by carrying out the minimum run-time checks. This option is for use after all debugging has taken place and maximum performance with minimum run-time checks is required.
Link Time Optimization is a form of interprocedural optimization that is performed at the time of linking application code. Without LTO, Arm Compiler for Linux compiles and optimizes each source file independently of one another, then links them to form the executable.
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:
--enable-optimizations
flag 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With