[net.micro] Nice 16-bit BenchMarker

ABN.ISCAMS@usc-isid.arpa (11/03/85)

NetLandians,

(Sorry if I hit you twice as members of both mailing lists)

I saw a pretty clean package of benchmarks on INFO-IBMPC and thought you
all might find them useful.  It HAS been a while since the last big
benchmark lists (in the medevial sense).  Not that I'm saying I have the
"fastest and bestest" of all micros .. but I would like to see some other
times from ATs (vanilla), ATs (Enterprise-class clock chips .. e.g.,
warp speed), maybe even a 68000 or two?

Regards,
David Kirschbaum
Toad Hall
ABN.ISCAMS@USC-ISID
{                                 CUT HERE                                }
(*
  From: SMERESKI.WBST@Xerox.ARPA
  Date: 1 Nov 85 14:00:04 EST
  Subject: NEC V30 vs 8086
  To: Info-IBMPC@USC-ISIB.ARPA
  Reply-to: Smereski.WBST@Xerox.ARPA

  I ran a test Turbo Pascal program on a Xerox 6065 (8 Mhz 8086) and again
  with the 8086 replaced by a NEC V30. Here are the results followed by
  the program listing.

  /Dave
  ---------------------------------------------------------------------------

  Results with a V30:

    String manipulation Test:                  17.2527 seconds.

    Integer Arithmetic Test:                   20.7692 seconds.

    Real Arithmetic Test:                      21.9231 seconds.

    Prime Number Sieve Test:                   13.7912 seconds.

  Results with an 8086:

    String manipulation Test:                  32.3077 seconds.

    Integer Arithmetic Test:                   31.8132 seconds.

    Real Arithmetic Test:                      22.9121 seconds.

    Prime Number Sieve Test:                   15.6593 seconds.

  And from Toad Hall, testing the 8MHz 80286 in the Gulfstream
  PC 286... (absolutely NO changes in code or procedures.  This
  machine is a PC clone, NOT an AT clone.  And I'm not kidding you,
  guys .. I knew this little sucker was fast, but THIS blew my socks
  off!)        David Kirschbaum
               ABN.ISCAMS@USC-ISID.ARPA

  Results with an 8MHz 80286, PC-DOS 3.1:

    String manipulation Test:                  10.9341 seconds.

    Integer Arithmetic Test:                   12.6374 seconds.

    Real Arithmetic Test:                      14.7253 seconds.

    Prime Number Sieve Test:                    8.3516 seconds.
*)

Program BenchMark;
{$R-}
{$V-}

Var
   Start : Real;

Function Time : Real;
Var
   TL : Integer Absolute $40:$6C;
   TH : Integer Absolute $40:$6E;
   R : Real;
Begin {Time}
Time := TL;
End; {Time}

{  Eratosthenes Sieve Prime Number Program in Pascal }
Procedure PrimeSieve;

{ This program counts the number of prime numbers between 2 and 16,380 It makes
  use of the fact that 2 is the only even prime and considers only odd numbers.
  The method of the sieve is to consider an ordered collection of integers
  that begins with a prime. If all multiples of that prime are stricken from
  the collection then the next highed number left in the list must be prime.
  Multiples of this prime are cast out. The process is repeated until the list
  is exhausted. The remaining list will only contain primes. The following
  algorithm assumes that 3, 5, and 7 are all prime (i + i + 3).
}
Const
   size =8190;

Var
   flags : Array [0..size] of Boolean;
   i, prime, k, count, iter : Integer;
   AnyKey : Char;

Begin {PrimeSieve}
For iter := 1 To 20 Do
   Begin
   count := 0;
   For i := 0 To Size Do flags [i] := True;  {initialize list to be considered}
   For i := 0 To size Do  {consider each odd number}
      If flags[i] Then
         Begin
         prime := i + i + 3;
         k := i + prime;
         While k <= size Do  {strike all multiples of the prime}
            Begin
            flags[k] := False;
            k := k + prime
            End;
         count := count + 1;  {increment count}
         End;
   End;
End; {PrimeSieve}

Procedure IntegerArithmetic;
Var
   I, J : Integer;
   M, N, O : Integer;
Begin {IntegerArithmetic}
N := 100;
O := 1234;
For I := 1 To 10000 Do For J := 1 To 30 Do M := N * O;
For I := 1 To 10000 Do For J := 1 To 30 Do M := N Div O;
For I := 1 To 10000 Do For J := 1 To 30 Do M := N + O;
For I := 1 To 10000 Do For J := 1 To 30 Do M := N - O;
End; {IntegerArithmetic}

Procedure RealArithmetic;
Var
   I, J : Integer;
   M, N, O : Real;
Begin {RealArithmetic}
N := 100.098;
O := 1234.53432;
For I := 1 To 1000 Do For J := 1 To 10 Do M := N * O;
For I := 1 To 1000 Do For J := 1 To 10 Do M := N / O;
For I := 1 To 1000 Do For J := 1 To 10 Do M := N * O;
For I := 1 To 1000 Do For J := 1 To 10 Do M := N - O;
End; {RealArithmetic}

Procedure StringTests;
Var
   C : Char;
   I, J : Integer;
   S, T : String [255];
Begin {StringTests}
For I := 1 To 50 Do
   Begin
   S := '';
   T := '';
   For J := 1 To 255 Do
      Begin
      T := Chr (J) + T;
      S := S + Chr (J);
      End;
   End;
For I := 1 To 50 Do
   For J := 1 To 255 Do
      Begin
      C := S [J];
      S [J] := S [256 - J];
      S [256 - J] := C;
      End;
End; {StringTests}

Procedure DisplayTime (StartTime : Real; X, Y : Integer);
Begin {DisplayTime (StartTime : Real; X, Y : Integer)}
GotoXY (X, Y);
Start := (Time - Start)/18.2;
Write (Start:20:4, ' seconds.');
End; {DisplayTime (StartTime : Real; X, Y : Integer)}

Begin {BenchMark}
ClrScr;
GotoXY (5, 3);
Write ('String manipulation Test:');
GotoXY (5, 5);
Write ('Integer Arithmetic Test:');
GotoXY (5, 7);
Write ('Real Arithmetic Test:');
GotoXY (5, 9);
Write ('Prime Number Sieve Test:');
Start := Time;
StringTests;
DisplayTime (Start, 35, 3);
Start := Time;
IntegerArithmetic;
DisplayTime (Start, 35, 5);
Start := Time;
RealArithmetic;
DisplayTime (Start, 35, 7);
Start := Time;
PrimeSieve;
DisplayTime (Start, 35, 9);
End. {BenchMark}

ABN.ISCAMS@usc-isid.arpa (11/05/85)

Michal,

I wasn't the LEAST bit interested in optimized code, clean code, or even
logical code .. just in how long it would take a machine (any machine) to
run this particular application given the SAME compiler.

Don't care if it's a 68000 emulating MS-DOS, an 8086 .. just will it
compile Turbo Pascal under MS-DOS and run the code?

The intent here was pure CPU/clock interaction (and maybe a little side
effect from MS-DOS implementations).  If it's a Cray running an MS-DOS
emulation, AND it can compile under Turbo Pascal 2.0 or 3.0 .. fine by
me.  What struck me was the interesting comparison of V20 and FAST 8086
times for different types of bit and byte fiddling, and how my 80286
stacked up against them.

Regards,
David Kirschbaum
Toad Hall
ABN.ISCAMS@USC-ISID