yea it does make a difference -- also you should be using
-march=athlon-xp
compiler optimizations are actually quite application specific as far as performance goes.
-g is to be avoided at all costs unless you need debugging symbols for some reason
The downside to all this fun is some programs will not compile and or run properly with agressive optimizations..
example:
i compiled cvs with
-march=pentium4 -O3 -funroll-loops -ftracer -momit-leaf-frame-pointer -fprefetch-loop-arrays
which is generally what i use for my P4 system all the time
later when i go to use it everything i do make it segfault and i have to recompile without the flags.
for some applications that are specific to a certain type of calculations -O3 can actually be slower than
-O2
or -O2 slower than -O1 with just some of the flags included in but not all.
for instance this is alot better (30% better) at math on my system than what i put above
-march=pentium4 -O1 -finline-functions -mieee-fp -fforce-mem -fschedule-insns -fstrict-aliasing -fomit-frame-pointer -fmove-all-movables -funroll-loops -ftracer -momit-leaf-frame-pointer -fprefetch-loop-arrays
for some real fun use
this
to figure out what exactly works best on your system
it is time well spent (if you'r a real nerd and like this sort of thing)