why does standard configure uses -Os?

Chris Jones jonesc at hep.phy.cam.ac.uk
Sun Dec 24 10:36:24 UTC 2017


> On 23 Dec 2017, at 11:12 pm, Joshua Root <jmr at macports.org> wrote:
>> On 2017-12-24 08:40 , Eitan Adler wrote:
>> In macports base in standard_configure.sh
>> there is this line:
>>  6 env PATH=/usr/bin:/bin:/usr/sbin:/sbin CFLAGS="-pipe -Os"
>> ./configure --enable-readline
>> Why do we compile with -Os instead of -O2?
>> As far as I could the only difference, in llvm 4.0.1, is to disable
>> the "libcalls-shrinkwrap" opt pass.
> It's what Apple uses, so presumably better tested. IIRC they found it
> tends to perform a little better than -O2.

In general its not possible to say one setting will always perform better than another,  its very use case dependant. For instance if you really want maximum numerical performance then -O3 can give significant gains, as it turns on a number of optimisations that can really help, like auto vectorisation. But, you would not want that as the default as some use cases might not like it. Its fine to have a default, but i would suggest each port should use whatever upstream has decided is its best optimisation level.

> - Josh

More information about the macports-dev mailing list