Click to See Complete Forum and Search --> : Using flags to compile


hard candy
08-04-2003, 01:38 PM
I was looking at another thread and decided to ask this question. It is about setting flags in Gentoo before compiling programs. It was triggered by the statement that the "-03" causes code bloat and slows the prgram down. I was going to post it in programming but after thinking and reading about it- it seems more of a difference of opinion and I figured it might belong in the "opinion" forum.
I'm confused, from what I have read the -03 flag is an "optimization" flag, which may not mean faster but I took it to mean more efficiently. Is this wrong?
Looking at this site, Freehackers (http://www.freehackers.org/gentoo/gccflags/flag_gcc3opt.html) , I used the Athlon XP 2000+ flags which include -03.
And this site seems to also suggest using the -03 flag. gcc optimization (http://computational-battery.org/Tools/gcc-opt-guide.html)
What do you think as to the best flags to use or if to use any at all.

Hayl
08-04-2003, 01:42 PM
man gcc

if you read through it, it will explain exactly what the -O3 flag does.

believe me, it causes code-bloat. it can make some binaries faster but most just get bloated.

if you still don't believe me, go onto #gentoo irc and ask. 99% of people on there have stopped using -O3. most people use -Os or -O2 now.

nextbillgates
08-04-2003, 02:04 PM
-O3 enables only two flags over -O2, -finline-functions and -frename-registers. -finline-functions makes the code larger, but does provide a benefit to processors with large amounts of cache (particarly L1 cache), such as the Athlon XP. -frename-registers significantly increases code size, on doesn't provide a noticable benefit to processor architectures with very few registers, such as x86.

Using -O2 and -finline-functions gives you the speed of -O3, without the bloat ;)

Sort of ;)