delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/01/18/17:06:58

From: "John Carter" <ECE AT dwaf-hri DOT pwv DOT gov DOT za>
Organization: Dpt Water Affairs & Forestry (IWQS)
To: djgpp AT delorie DOT com
Date: Thu, 18 Jan 1996 12:41:28 +0200
Subject: Speed,V1&V2,Pentium&486
Message-ID: <C2C10C3610@dwaf-hri.pwv.gov.za>

Here is a wee bizzarity for those who collect such...

I ran my pet floating point bench mark on a 486DX2-66 and a
Pentium 75.

I compile it using the DJGPP V1m4, and DJGPP V2 beta4.

Here is the wee benchmark...

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

main( int argc, char * argv[])
{
  int n;
  double x, y, delta;
  int start, finish;
  time_t now;
  sscanf( argv[ 1], "%d", &n);

  x = 1.0;
  y = 1.0 + 1.0 / n;

  start = clock();

  time( &now);
  printf("The current time is %s", asctime(localtime(&now)));

  for( int i=0; i < n; i++)
    x *= y;

  finish = clock();

  time( &now);
  printf("The current time is %s", asctime(localtime(&now)));

  delta = (finish - start) / (double)CLOCKS_PER_SEC;

  if( start == finish)
    printf( "y-1=%e, x=%f, time=%8.3f\n", y-1.0, x, delta);
  else
    printf( "y-1=%e, x=%f, time=%8.3f, iters/sec=%d\n", y-1.0, x,
      delta, (int)(n / delta));
}

Results :-
486DX2-66  DJGPP V1  1793562 Iterations/sec
486DX2-66  DJGPP V2  1847715 Iterations/sec
Pentium 75 DJGPP V1  7585273 Iterations/sec
Pentium 75 DJGPP V2  4136363 Iterations/sec
The granularity of the clock ticks is about 0.055sec.

Note the bizzarity. DJGPP V2 is faster than V1 on the 486, but V2 is
a lot slower than V1 on the Pentium! Weird. Maybe the clock() call is
doing something funny, but I don't think so.

Any ideas?


John Carter
Institute for Water Quality Studies. Department of Water Affairs.
Internet : ece AT dwaf-hri DOT pwv DOT gov DOT za  Phone    : 27-12-808-0374x194      
Fax : 27-12-808-0338 [Host for Afwater list server]

Founder of the Council for Unnatural Scientists.

- Raw text -


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