Boost logo

Boost-Build :

Subject: Re: [Boost-build] Choice of optimization flags for GCC
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2008-09-08 17:05:40


On Monday 08 September 2008 22:51:11 David Abrahams wrote:
>
> According to http://www.gentoo.org/doc/en/gcc-optimization.xml, we are
> using suboptimal optimization settings when building on GCC-4.x (-O3;
> they say it should be -O2). I seem to recall hearing from someone (who
> ought to know) that -O3 was actually strictly experimental and not even
> guaranteed to produce correct code. But I may be misremembering and I
> am unable to corroborate any of this. Anyone?

FWIW, CodeSourcery's support recommends -O2, because -O3 was found not to
be uniformly better than -O2. But we're on thin ice here -- benchmarks
results are valid for a specific compiler version, with specific vendor
patches and configuration so that recommendation may be right for our
specific release, but not necessary right for every random gcc in the wild.

If a user really care for performance, he can experiement with
specific flags, adding them via cxxflags feature. Say, gcc benchmarks on

        http://gcc.gnu.org/benchmarks/

use contrived flags, like, for example:

        -O3 -funroll-loops -fpeel-loops -ffast-math

- Volodya


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk