Kihaji wrote:Lovechild wrote:Kihaji wrote:The way I always looked at it:
O2 optimizes for size
O3 for speed.
Then how does your flawed theory explain away Os ?
From the site:
O2 - "Optimize even more. GCC performs nearly all supported optimizations that do not involve a space-speed tradeoff. "
O3 - "Optimize yet more. -O3 turns on all optimizations specified by -O2 and also turns on the -finline-functions and -frename-registers options. "
Which to me implies the space-speed consideration is not used. Hence O2 is more size conscience than O3.
Os is a step below O2 speed wise, but increases the space savings.
Does that satisfy you? Or would you like to stick your foot deeper into your mouth?
Let's try to keep this civil guys, we don't need any flamewars here. What I post below is my interpretation of the explanation from the gcc man page (no I don't have tons of benchmarks for you). If anyone disagrees with my interpretation of the man page, feel free to respond and please include your reasons for disagreeing with me, but childish responses need not apply.
*dons flame retardant suit*
O3 optimizes for speed without regard to size at all - your executables will take up more space with this, but (hopefully) will be faster. (Most likely, please no pathological counter examples)
O2 optimizes for speed as much as possible - without actually increasing size dramatically (i.e. no loop-unrolling, inline functions, etc). However, it makes no claim to actually have any sort of space savings, so I don't agree that it optimizes for space, however it doesn't shoot itself in the foot either. Most likely a nice balance is achieved.
Os is similar to O2, but is borderline psycho about not increasing size, and even does some stuff to decrease size.
And now I'll duck out and if you two want to continue baiting each other, feel free. I always wanted to jump in the middle of a flame war

Do you lock your car when you leave it out in public? Why not do the same with your computer?