Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: patchkov@acs1.acs.ucalgary.ca (Serguei Patchkovskii)
Subject: Re: DecC vs. gcc-2.8.1, why is the difference in speed so large?
Date: 1999/06/08	[thread overview]
Message-ID: <7jjcs4$kvg@ds2.acs.ucalgary.ca> (raw)
In-Reply-To: njmp_walti-0406991535540001@otto-5.ethz.ch

Christoph Walti (njmp_walti@njmp_solid.phys.ethz.ch) wrote:
: recently, I compared the speed of a very simple program (posted below),
: which was once compiled using DecC and a second time using GNU gcc-2.8.1
: on a Digital-alpha staion DS20 with DUnix4.0F. To my very surprise, the
: DecC-compiled version was at least 30, if not even 50 times as fast as the
: gcc-compiled version! I did not use any optimisation flags, but the ones

[snip]

:   void do_that(int *anz)
:   {
:   int i,j,x;
:   for (i=0; i <15; i++)  {
:     printf("doing this\n");
:     x=0;
:     for (j=0; j <10000000; j++) x=x+i;   /* 10 millions */
:     (*anz)++;
:     }
:    }

Your benchmark is meaningless, as the entire inner loop computing 'x'
can be eliminated after simple local analysis of the do_that() subroutine.
gcc deliberately refrains from performing loop elimination in such cases,
as this can result in unexpected results for programs relying on loops for
delays (which is a bad idea in any case - but that had never stopped anyone).
DEC cc apparently removes your inner loop at the default optimization level,
which can easily explain a factor of 50 difference in the timing.

/Serge.P

--
home page: http://www.cobalt.chem.ucalgary.ca/ps/



  parent reply	other threads:[~1999-06-08  4:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-04  4:00 DecC vs. gcc-2.8.1, why is the difference in speed so large? Christoph Walti
1999-06-04  4:00 ` David T. Blake
1999-06-08  4:00   ` Jeff Sullivan
1999-06-07  4:00 ` Mark Gelinas
1999-06-08  4:00 ` Serguei Patchkovskii [this message]
1999-06-08  4:00   ` Jeff Sullivan
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox