From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 5962 invoked from network); 1 Oct 1998 16:50:16 -0000 Received: from mail.redhat.com (199.183.24.239) by mail2.redhat.com with SMTP; 1 Oct 1998 16:50:16 -0000 Received: from fishnet.caltech.edu (johns@grouper.fishnet.caltech.edu [131.215.147.2]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id MAA05059 for ; Thu, 1 Oct 1998 12:48:10 -0400 Received: (from johns@localhost) by fishnet.caltech.edu (8.8.7/8.8.7) id JAA12919; Thu, 1 Oct 1998 09:46:53 -0700 Date: Thu, 1 Oct 1998 09:46:53 -0700 Message-Id: <199810011646.JAA12919@fishnet.caltech.edu> From: John Salmon To: axp-list@redhat.com Subject: sqrt 10x slower in 2.0.7-19 than 2.0.6-9 ??? I am encountering some very strange performance numbers with sqrt in the glibc math library on the alpha. Executive summary: sqrt from the glibc-2.0.6-9.alpha.rpm appears to be over 10 times faster than sqrt in glibc-2.0.7-19.alpha.rpm. Details: I have two machines on which I can run tests. Both are 533Mhz EV56 systems. The primary hardware difference is that one is an LX164 and the other is an SX164. I don't think that's relevant to the problem, but 'full disclosure' is always a good idea. /proc/cpuinfo is attached at the end of this note. Machine 1 (LX164) has RH5.1 and glibc-2.0.7-19 installed from the updates rpm. Machine 2 (SX164) has RH5.0 and glibc-2.0.6-9 installed from an rpm (source unknown, possibly from updates, but it no longer exists at ftp.redhat.com). A very simple code that times a loop of 1million calls to sqrt is attached. I compiled it with -static on both platforms and then ran the resulting executable on both platforms. On both platforms, the glib-2.0.6-9 code runs nearly eleven times faster. For example: [johns@paranal junk]$ sqrtloop.static.06 1000000 sqrts in 0.1952 sec, 5.12295e+06 per sec [johns@paranal junk]$ sqrtloop.static.07 1000000 sqrts in 2.13549 sec, 468277 per sec [johns@paranal junk]$ Compiling without -static gives consistent results. I..e., the machine with the 2.0.6 dynamic library is faster by about a factor of 10, regardless of where the compilation was performed). So the question is: Why is the 2.0.7 sqrt so much slower than the 2.0.6?? I thought I'd take a look at glibc-2.0.6-9.src.rpm to try to find out. I can't find it anywhere! (HotBot, ftp.redhat.com). Does anybody have an archived copy? Thanks for your help, John Salmon Appendix 1: C source code to sqrtloop.c [johns@paranal junk]$ cat sqrtloop.c --------------------------- #include #include #include #include #define NTIMES 1000000 int main(int argc, char **argv){ int i = NTIMES; double x = 0.7; clock_t tstart, tend; double seconds; tstart = clock(); while(--i){ x = sqrt(x) + 0.5; } tend = clock(); seconds = ((double)(tend-tstart))/CLOCKS_PER_SEC; printf("%d sqrts in %g sec, %g per sec\n", NTIMES, seconds, NTIMES/seconds); return 0; } ----------------------------- Appendix 2: /proc/cpuinfo details Machine 1 (glibc-2.0.7-19.rpm) [johns@paranal junk]$ cat /proc/cpuinfo cpu : Alpha cpu model : EV56 cpu variation : 0 cpu revision : 0 cpu serial number : Linux_is_Great! system type : EB164 system variation : LX164 system revision : 0 system serial number : MILO-0000 cycle frequency [Hz] : 0 timer frequency [Hz] : 1024.00 page size [bytes] : 8192 phys. address bits : 40 max. addr. space # : 127 BogoMIPS : 530.57 kernel unaligned acc : 0 (pc=0,va=0) user unaligned acc : 134 (pc=155556b77a0,va=11ffff8c8) platform string : N/A Machine 2 (glibc-2.0.6-9.rpm): [johns@avalon2 libm]$ cat /proc/cpuinfo cpu : Alpha cpu model : EV56 cpu variation : 0 cpu revision : 0 cpu serial number : Linux_is_Great! system type : EB164 system variation : SX164 system revision : 0 system serial number : MILO-0000 cycle frequency [Hz] : 0 timer frequency [Hz] : 1024.00 page size [bytes] : 8192 phys. address bits : 40 max. addr. space # : 127 BogoMIPS : 528.48 kernel unaligned acc : 0 (pc=0,va=0) user unaligned acc : 220 (pc=155556dc6b0,va=11ffffc40) platform string : N/A