This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gcc 3.1 seems to be much slower then 3.0 in some cases


Hello,
i was doing some testing with different versions of the gcc and
different options.

My experiences: gcc-3.0.4 with -O3 a few percent fast than 2.95.4 with
-O3, and gcc-3.1 with -O3 is 10 (!!) times slower with this special
function.

So I have reduced the programm and I think it is about how registers are
used.
Because if I comment out line 4, that the version that is compiled with
3.1 is as fast as the version compiled with 3.0.

Here is my test code and bellow, because this are just a few lines:
http://ijuz.uugrn.org/minmax_gcc2.c
(complete version: http://ijuz.uugrn.org/minmax_gcc.c)

ijuz@core:~$ gcc-3.0 -O3 minmax_gcc2.c ;time ./a.out
real    0m0.289s
user    0m0.260s
sys     0m0.000s
ijuz@core:~$ gcc-3.1 -O3 minmax_gcc2.c ;time ./a.out
real    0m1.860s
user    0m1.550s
sys     0m0.000s

[commented line 4 out]
ijuz@core:~$ gcc-3.1 -O3 minmax_gcc2.c ;time ./a.out
real    0m0.325s
user    0m0.260s
sys     0m0.000s

(Duron 900, with Debian GNU/Linux and gcc 3.0.4 and gcc 3.1.1
(20020531) it was the same with 3.1)

<code>
int min_max_sqr(int a,int b, int c, int d)
{   
        int min_ab, max_ab, min_cd, max_cd;
        int min; //// this is the line
        if(a<b) {min_ab=a; max_ab=b;}
        else {min_ab=b; max_ab=a;}
        if(c<d) {min_cd=c; max_cd=d;}
        else {min_cd=d; max_cd=c;}

        return min_ab;
}

int main(void)
{
        int out,i;
        for(i=0;i<100000000;i++) out=min_max_sqr(1,3,5,6);
        exit(0);
</code>

I have double checked this on another system.

Sorry, if this nothing new or it's just because I'm dumb.

Regards
Christian Leber
-- 
  "Omnis enim res, quae dando non deficit, dum habetur et non datur,
   nondum habetur, quomodo habenda est."       (Aurelius Augustinus)
  Translation: <http://gnuhh.org/work/fsf-europe/augustinus.html>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]