O flags

Jeffrey Walton noloader@gmail.com
Mon May 25 00:26:00 GMT 2015

On Sun, May 24, 2015 at 2:15 PM, Robert Mijakovic <mijakovi@in.tum.de> wrote:
> Dear all,
> I have done some experiments with optimization flags enabled by different O
> flag levels.
> I took optimizations enabled by O[1..3] and tried to enable them all at once
> without calling
> O flag levels. I have found out that improvements I got by using all flags
> used by the
> particular O flag level are not even close to what I would get by explicitly
> using O flag levels.
> What is the reason for not reaching the same level of performance of O flag
> levels?
Related, -Os usually gives me the best performance.

I believe -Os often gives me the best performance because it keeps the
caches hot. Its the same observation Richter made with respect to
Windows performance.

Richter is a Windows author and guru. He wrote the Advanced Windows
Programming series (http://www.amazon.com/dp/1572315482).

-Os is also useful on mobile, where you have to watch for code bloat.


More information about the Gcc-help mailing list