Nick Smith wrote:
-O3 is more optimized than -O2, but those optimizations usually make the
binaries larger which causes other slowdowns. The ideal system-wide optimization
level is -O2 or -Os (-O2 with additional flags for small binaries).
could you go a little further on this? whats the difference between -O2
and -Os? which is better for overal and what additional flags for small
binaries are you talking about?
From 'man gcc':
-O2 Optimize even more. GCC performs nearly all supported optimiza-
tions that do not involve a space-speed tradeoff. The compiler
does not perform loop unrolling or function inlining when you spec-
ify -O2. As compared to -O, this option increases both compilation
time and the performance of the generated code.
-O2 turns on all optimization flags specified by -O. It also turns
on the following optimization flags: -fforce-mem -foptimize-sib-
ling-calls -fstrength-reduce -fcse-follow-jumps -fcse-skip-blocks
-frerun-cse-after-loop -frerun-loop-opt -fgcse -fgcse-lm
-fgcse-sm -fgcse-las -fdelete-null-pointer-checks -fexpen-
sive-optimizations -fregmove -fschedule-insns -fschedule-insns2
-fsched-interblock -fsched-spec -fcaller-saves -fpeephole2 -fre-
order-blocks -freorder-functions -fstrict-aliasing
-funit-at-a-time -falign-functions -falign-jumps -falign-loops
-falign-labels -fcrossjumping
<snip>
-Os Optimize for size. -Os enables all -O2 optimizations that do not
typically increase code size. It also performs further optimiza-
tions designed to reduce code size.
-Os disables the following optimization flags: -falign-functions
-falign-jumps -falign-loops -falign-labels -freorder-blocks
-fprefetch-loop-arrays
--
Andrew Gaffney
Gentoo Linux Developer
Installer Project
http://dev.gentoo.org/~agaffney/
--
[email protected] mailing list