Is pic related true with gcc 7?
I started using Gentoo about six months ago and so far I've been just using -O2 -pipe -march=native as advised on the wiki. I'm considering trying -O3, but most of the discussion I can find about the practical effects of enabling it in make.conf is 10 years old and seemingly not applicable to modern GCC versions, which have obviously changed a lot.
I'm using an SSD so binary size isn't so important. I also don't mind if it breaks a few packages since I can easily switch those to -O2. The question is, as in the pic, whether it should be used as a general optimization flag.
>>60717189
That's a good question. Test a few out and report back your findings. Compare binary size and performing the same tasks the same number of times.
What would be a complex but easily scriptable test program?
>>60717260
Professor?
>>60717260
I've seen benchmarks for a few apps on Phoronix that generally give an edge to -O3. Given that the effects vary per app I'm not sure how feasible a system-wide benchmark would be.
And AFAIK the increase in binary size is pretty modest with just -O3, as stuff like -funroll-all-loops isn't included. Plus using -march=native is supposed to help because it lets GCC take the CPU cache size into account.
Yes gcc 7 didn't change anything in that regard.
>>60717189
Never use -O3, just my two cents
I use -Ofast get on my level
http://gentoo.no-ip.org
>>60717863
Is this your own repo or something?
>>60717863
-Ofast breaks standard-compliant programs unlike -O3 and can produce incorrect results. Better to turn it on for specific packages only. It only helps if a lot of floating-point operations are done anyway.
>>60717189
No, unless you never need things like TCO. So it can be safer as well. Generally I'd run both to see what's faster, if I'm worried, as it depends too much on what you write.
>>60717189
>practical effects
perhaps if your're compiling for an embedded system, then the smaller binary size and additional inconsequental compliation overhead wouldn't be an issue
but on a main rig, perhaps you should set your -march=native to your actual cpu like --march=haswell and specify your cflags to really get your processer cranking on the job, don't forget to add the latest microcode aswell
>>60717189
You rather it runs fast or runs correctly? O2 is much less likely to produce incorrect code, and the difference in performance is quite minor.