This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc: poor log() performance on Intel x86_64
- From: Andrew Haley <aph at redhat dot com>
- To: Torsten Rohlfing <torsten at synapse dot sri dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 15 Mar 2006 10:58:10 +0000
- Subject: Re: gcc: poor log() performance on Intel x86_64
- References: <4417332A.7050004@synapse.sri.com>
Torsten Rohlfing writes:
> 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
You have weird hardware.
[aph@zorro ~]$ time ./testlog64
real 0m7.330s
user 0m7.328s
sys 0m0.004s
[aph@zorro ~]$ time ./testlog32
real 0m7.538s
user 0m7.528s
sys 0m0.000s
Andrew.