When I try to compile Python 3.6 on an arm-based Linux machine,./configure returns the following:
What is the purpose of —enable-optimizations?
Asked by Yashar
Profile guided optimization (PGO) and Link Time Optimization are enabled by this flag (LTO).
Both are time-consuming enhancements that slow down the construction but result in a large speed increase (around 10-20 percent from what I remember reading).
The specifics of what these do are beyond my understanding and possibly too wide for a single inquiry. In any case, you may learn a little about LTO from the GCC documentation, which includes an implementation, and get a head start on PGO by reading the wiki page.
Also, take a look at the related bugs that have been posted to the Python Bug Tracker:
LTO isn’t always enabled with the —enable-optimizations flag, as @Shuo pointed out in a comment and as noted in Issue 28032. Some platforms will disable it in the configuration script (depending on the supported version of gcc).
Future versions of this flag will very certainly always have it enabled, thus it’s safe to discuss both of them here.
Answered by Dimitris Fasarakis Hilliard
Post is based on https://stackoverflow.com/questions/41405728/what-does-enable-optimizations-do-while-compiling-python