Compiler optimization (was Re:linuxcaffe; distros and desktops)

Noah John Gellner noah.gellner-H217xnMUJC0sA/PxXw9srA at public.gmane.org
Sun Oct 31 00:02:31 UTC 2004


I had been using fairly conservative compile flags but after taking
Ubuntu for a spin I got the urge for mad optimization. My current flags
are working so far, although it seems something of a miracle to me. I am
running:
CFLAGS="--param max-unrolled-insns=16 -fsingle-precision-constant
-DNO_DEBUG -g0 -funroll-loops -ffast-math -finline-limit=4096
-march=pentium4 -fomit-frame-pointer -pipe -ftracer -O3
-fmerge-all-constants -fprefetch-loop-arrays"
CXXFLAGS="-fabi-version=0 -ffunction-sections -DNO_DEBUG -g0 --param
max-unrolled-insns=16 -funroll-loops -ffast-math -finline-limit=4096
-march=pentium4 -fomit-frame-pointer -fprefetch-loop-arrays -pipe
-fsingle-precision-constant -ftracer -O3 -fmerge-all-constants
-fpermissive -fno-enforce-eh-specs"
LDFLAGS="-Wl,-O1 -Wl,--enable-new-dtags -Wl,--sort-common -s"

It is madness. Maybe it is just me, but the apps at the console seem
snappier. I know I should run some proper tests to see if there is any
gain, at all, for a near certainty of increased instability. 

On 19:36 Sat 30 Oct     , Anton Markov wrote:
> 
> Noah John Gellner wrote:
> >I have been wondering about the differences between -O2 and -O3. I
> >typically use -O2, but I am starting to experiment about -O3. For a P4
> >2.4 w/ 684M of RAM, should -O3 be faster?
> 
> I am no expert on this, but I researched into compiler optimization some 
> time ago.
> 
> Your best friend is the GCC manpage "man gcc". Do a search (hit "/") for 
> -O2; there should be a detailed description burried in the manpage. 
> Basically -O2 improves performance at the expense of compilation time. 
> -O3 should slightly increase performance but will make the final code 
> larger, which may or may not hurt performance in the end (load times, 
> RAM/Swap usage, etc.). I personally have never used -O3.
> 
> Since you have a P4, you can optimize the code (especially 
> graphical/computational programs) by enabling the MMX/SSE/SSE2 math 
> instructions and other CPU-specific stuff. Search the gcc manpage for 
> "Intel 386 and AMD x86-64 Options" and read the descriptions.
> 
> On my P4 2.4GHz I used the following when compiling the X.Org server:
> "-O2 -march=pentium4 -mmmx -msse -msse2 -mfpmath=sse"
> 
> -- 
> Anton Markov <("anton" + "@" + "truxtar" + "." + "com")>
> 
> GnuPG Key fingerprint =
> 5546 A6E2 1FFB 9BB8 15C3  CE34 46B7 8D93 3AD1 44B4
> 
> *** LINUX - MAY THE SOURCE BE WITH YOU! ***



-- 
Even Buddha punished evil - "Master Killer"
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list