From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: X-Archive-Original-Message-ID: <9703201958.ZM1954@fabsoft2.zarm.uni-bremen.de> Date: Thu, 20 Mar 1997 21:19:21 +0100 From: Claus Denk Subject: Re: Interesting gcc to cc comparison Jim Nance wrote: > > Hello All, > I have a program here that I thought you all might be interested in. > Its a little benchmark that I wrote that multiplies 2 matrices. The nice > things about it are that it is quite short and it does a good job of > exposing weaknesses in gcc. Hopefully it will be of interest to people > working on improving gcc. > snip ... > Here are the results for multiplying > two 400x400 matrices 3 times: > > Simple 2x2 4x4 > cc 8.016346 2.849886 4.199832 > gcc -O2 12.232844 3.833180 10.182926 > gcc -O3 12.032852 3.383198 10.116262 > Note: that was AlphaStation 500/500 384M, DU 4.0 Hi Jim and all, I got your source code and made some tests. We have a PC164/500 Mhz 1 Mb Cache over here, and I would be interested in some of your timings for smaller matrices, so that they fit into 1 Mb Cache. (I think your machine has 8 Mb, right ?). Could you send me some ? My results with your original program are: (gcc -static -O3 -funroll-all-loops ) 1 2 3 a.out 400 3 : 17.77 5.31 11.21 a.out 100 500 : 12.22 4.56 23.19 a.out 40 10000 : 11.28 4.29 28.74 (where i commented out the printf(".") + fflush(stdout) statements) You can speed up mat_mul_3 quite a bit (for gcc) using a temporary variable sum for the innermost loop, like you do in mat_mul_1: double sum = 0; for(kk=0; kk<4; kk++) { sum += aa[ii][kk] * bb[kk][jj]; } cc[ii][jj] = sum; 3 a2.out 400 3 : 7.71 a2.out 100 500 : 15.65 a2.out 40 1000 : 19.10 So that looks like as if gcc definitely could do something better here (Or is the programmer supposed to do that ?). I would be really interested in your results (with cc & gcc) for the smaller matrices, so if you find the time... I think I can not run the DU 4.0 binaries, due to my 2.0.23 kernel. regards, Claus Denk -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com