delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/07/20:37:58

Message-ID: <3501fea9.flying-brick@flying-brick.caverock.net.nz>
From: Eric Gillespie <root AT flying-brick DOT caverock DOT co DOT nz>
To: djgpp AT delorie DOT com
Date: Sun, 8 Mar 1998 14:12:55 NZT-12DST
Subject: Speed Test - TC vs. DJGPP
Reply-to: root AT flying-brick DOT caverock DOT net DOT nz

I have come up with some rather interesting results on my AMD 486/40, w/8 
megs of memory, which seems to be a VERY slow machine compared with the 
speed demons running under Win 95, NT and maybe even Linux DOSEMU. 
I have been comparing TC++ v1.0 with DJGPP 2.01, I got 22 tics for the
TC executable, with the other times for DJGPP 2.01 compiled executables 
from the following compile lines:

gcc -o speed.exe speed.c -s              90 ticks
gcc -O (or -O2) -o speed.exe speed.c -s  55 ticks
gcc -O3 -o speed.exe speed.c -s           5 ticks!
The last result seems to be comparable to what the other person had got 
with TC3, so I'm not complaining!
I revised the code slightly (to shut up TC++, and to actually get some work 
out of the function-calling mechanism).


#include <stdio.h>
#include <time.h>
#include <conio.h>

long sub(long i)
{
return(++i);  /* just to get the function to DO something ... */
}

void main(void)
{
clock_t start,end;
long n,time;

clrscr();
start=clock();
for (n=0;n<1000000L;)
{
n=sub(n);
}
end=clock();
time=(end-start);
printf("\nBeginning tics: %ld \nEnd tics: %ld\n",start, end);
time/=CLOCKS_PER_SEC;
printf("sec:%ld\n",time);
}

Just to put my 2 cents in...
I conclude there must be something wrong with using debugging options 
turned on - but why such a difference?
The Viking

--
     Super User
 /|   ,.:*^*:.,   |\  Cheers from the Viking family ... including Marmalade
| |_/' viking@ `\_| | Running M$DOG in Christchurch!
|   flying-brick    | $FunnyMail 5.38 C.S. Lewis:  If Man has no God,
 \_.caverock.net.nz/  then where did Man's morals come from?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019