Greetings.
I am experiencing a major performance problem with the log() function on
the x86_64 platform. It can be illustrated with the following little
test program:
====testlog.cxx=======
#include <math.h>
main()
{
float f = 0;
for ( int i = 0; i < 1e8; ++i )
f += log( i );
}
==================
I compile this twice, on the same machine, once as a 64bit binary and
once as 32bits:
g++ -mtune=nocona -msse -msse2 -msse3 -O3 -o testlog64 testlog.cxx
g++ -m32 -mtune=nocona -msse -msse2 -msse3 -O3 -o testlog32 testlog.cx
Compiler config is:
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
--host=x86_64-redhat-linux
Thread model: posix
gcc version 4.0.2 20051125 (Red Hat 4.0.2-8)
When I run the two binaries on the exact same box and time them, I get
the following outputs:
time ./testlog64
13.264u 0.000s 0:13.26 100.0% 0+0k 0+0io 0pf+0w
time ./testlog32
6.960u 0.004s 0:06.96 100.0% 0+0k 0+0io 0pf+0w
In other words, the log function is approximately twice as fast in the
32bit binary as it is in the 64bit binary. Does anyone have any idea
what this is caused by or how I could further diagnose the problem? It
seems that using logf() I get approximately identical performance for
both targets, but unfortunately then the results I get are slightly
different for the two, and that's also not acceptable.
Thanks to everyone in advance for any insights you may be able to provide!
Torsten
--
Torsten Rohlfing, PhD SRI International, Neuroscience Program
Research Scientist 333 Ravenswood Ave, Menlo Park, CA 94025
Phone: ++1 (650) 859-3379 Fax: ++1 (650) 859-2743
[EMAIL PROTECTED] http://www.stanford.edu/~rohlfing/
"Though this be madness, yet there is a method in't"