Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* DecC vs. gcc-2.8.1, why is the difference in speed so large?
@ 1999-06-04  4:00 Christoph Walti
  1999-06-04  4:00 ` David T. Blake
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Christoph Walti @ 1999-06-04  4:00 UTC (permalink / raw)


Hi,

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
which are set by default (are there any? I don't know.)
Does someone know, where this enormous difference comes from? Does the
DecC compiler realize, that in this loop nothing is to do anyway, and
therefore, the result is known from the very beginning and can be put in
the executable directly?

Thanks for your help

Chris


PS1: This difference in speed persists, when the printf-statement is removed.
PS2: The gcc version was compiled on this machine (and should be optimized
for ev6).






#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <setjmp.h>
#include <stdlib.h>
#include <unistd.h>
 
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
 
 
  void do_that(int *);
 
  int r1=0, r2=0;
 
  main()
  {
 
  do_that;
 
 
  }
 
  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)++;
    }
   }



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1999-06-08  4:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
1999-06-08  4:00   ` Jeff Sullivan

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