This is the mail archive of the
mailing list for the GCC project.
gcc: poor log() performance on Intel x86_64
- From: Torsten Rohlfing <torsten at synapse dot sri dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 14 Mar 2006 13:18:34 -0800
- Subject: gcc: poor log() performance on Intel x86_64
I am experiencing a major performance problem with the log() function on
the x86_64 platform. It can be illustrated with the following little
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.
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
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:
13.264u 0.000s 0:13.26 100.0% 0+0k 0+0io 0pf+0w
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 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
"Though this be madness, yet there is a method in't"