[Wheel-builders] manylinux compile/optimization options
Vlad K.
vlad-fbsd at acheronmedia.com
Wed Dec 6 15:22:21 EST 2017
On 2017-12-06 19:29, Marcel Martin wrote:
>
> Why do you think so? As far as I know, using -O3 is perfectly normal
> and
> safe!
Because experience has shown that blanket -O3 can lead to undefined
behavior or "optimizations" that actually result with worse performing
code. I have certainly seen broken code with global -O3, and it is
illadvised on Gentoo as a global option. Instead individual packages
enable -O3 if it's known that the flag will produce adequate and faster
code.
Also Phoronix has some tests that show -O3 better in some cases, but
worse in others, for example:
https://www.phoronix.com/scan.php?page=article&item=clear-gcc6-opts&num=2
and previously
https://www.phoronix.com/scan.php?page=article&item=gcc_47_optimizations&num=1
Both on FreeBSD and Gentoo pip will compile without any -O flags, even
though Python (on both) is compiled with -O2. However on FreeBSD the
compiler is clang, and talking to some developers I was informed that
-O3 is not a solution, but using LLVM's LTO is. LTO is also a subject in
some experimental Gentoo builds.
There may be individual python ports that explicitly enable -O3, but I
haven't checked for those. With that, I wanted to understand this
behavior for Pillow so I can submit a change requesting Pillow be
compiled with -O3 for now, until LTO is understood better (and
available, I think it requires LLVM newer than the one in FreeBSD base),
because from what I've seen the difference is seriously significant, and
so far I see no breakage, running Pillow compiled with -O3 in
production.
--
Vlad K.
More information about the Wheel-builders
mailing list