> What version of gcc do you have?

$ gcc --version
gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3

> Also, on OS X I'm using the -fast option to gcc, which is often 2-3x faster 
> than -O3.

--fast is a Mac OX X only option
(http://developer.apple.com/mac/library/documentation/DeveloperTools/gcc-4.0.1/gcc/Optimize-Options.html)

I've dig and read a little about compilation flags:
- gcc man pages
- gentoo Compilation Optimization Guide (a linux distro where they
recompile every bit), and they recommend "-march=k8 -O2 -pipe"
- AMD GCC Quick Reference Guide (my CPU is AMD Athlon 64 x2), and they
recommend "-O3 -mtune=k8 -funroll-all-loops -fprefetch-loop-arrays
-ffast-math"

Here are the results:

With defaults from "./acprep opt" :
CFLAGS = -O3 -fomit-frame-pointer
CXXFLAGS = -fpch-deps -Wconversion -pthread -O3 -fomit-frame-pointer -pipe
    time ~/ledger/ledger    reg -X € -J > /dev/null
    real        2m5.204s

With CXXFLAGS = CFLAGS = -march=k8 -O2 -pipe
    time ~/ledger-O2/ledger reg -X € -J > /dev/null
    real        2m12.285s

With CXXFLAGS = CFLAGS = -O3 -mtune=k8 -funroll-all-loops
-fprefetch-loop-arrays -ffast-math
    time ~/ledger-O3/ledger reg -X € -J > /dev/null
    real        2m13.937s

My conclusion is that I will stick with defaults compiler flags from
"acprep opt"...

Thierry

Reply via email to