[comp.sys.mac] MacII/Compaq386 comparison

housen@ssc-vax.UUCP (Kevin Housen) (12/14/88)

A friend of mine was making some speed comparisions between
a Compaq 386 and a Mac II.  The results seem a little strange,
so I thought I'd see if anyone who knows about the 386 could
shed some light on this.

The benchmarks were written in Fortran.  The MacII version used
Absoft's version 2.3/020 Fortran compiler (with the 020/881
switches on).  I dont know the details of the Compaq, but I was told it
is a 386 with a 387 (running at either 16 or 20 MHz).  Unfortunately
I dont know anything about the Fortran compiler for the Compaq.

Two benchmark programs were run.  They are both very short, so I
included the source below.  The first benchmark solves an ODE, doing
a lot of trig functions.  On the Mac II this takes about 27 seconds to
run.  The Compaq ran about a factor of 3 slower than the Mac II
(I dont have the exact execution time with me).  The second program
basically just does a lot of adds of array elements.  The Mac II version
ran in just over 40 sec.  On the other hand the Compaq ran it about 
5 times faster (about 8 sec)!

Why should there be such a large discrepency (x15) in the execution times
for these two cases?  Has anyone else tried similar comparisons between
the two machines?  If so, I'd appreciate hearing about it.  I guess this
underscores the fact that benchmarks should be taken with a large
grain of salt.

BTW - this is not intended to start an 020/386 war....

Thanks heaps,

Kevin Housen


Benchmark #1:

c....	program solves ode system y'=x*sin(y+z2)-cos(x2+y/(1.+y2))2
c....	z'=-(y2-x2)*e(-(y+z)2)/(1.+C(abs(x+y+z)))
	x=0.
	y=1.
	z=1.
	dx=.001
	do (kk=1,100000)
	  y1=y+dx*(x*sin(y+z*z)-cos(x*x+y/(1.+y*y))**2)
	  z1=z-dx*(y*y-x*x)*exp(-(y+z)**2)/(1.+sqrt(abs(x+y+z)))
	  y=y1
	  z=z1
	  x=x+dx
	repeat
	end

Benchmark #2:
	real*4 a(101,101)
	do (i=1,101)
	  do (j=1,101)
	    a(i,j)=0.
	  repeat
	repeat
	do (i=1,101)
	  a(1,i)=1.
	  a(101,i)=0.
	  a(i,1)=1.
	  a(i,101)=1.
	repeat
	do (kk=1,50)
	  do (i=2,100)
	    do (j=2,100)
	      a(i,j)=0.25*(a(i+1,j)+a(i-1,j)+a(i,j-1)+a(i,j+1))
	    repeat
	  repeat
	repeat
	end

mcdonald@uxe.cso.uiuc.edu (12/18/88)

Here are the results on the two small Fortran test programs that were posted:
They were done on an IBM PS2-80 at 16MHz with a 387. They should take
about 65 to 70% as long on a high class 20Mhz machine like a Compaq or
a Dell 310 (that is, the Model 80 is slow for a 16 MHz machine).

Neither program as listed was Fortran; there does not exist a "repeat"
keyword in either Fortran 66 or Fortran 77; about draft F8x I forget. 
However, the intent was obvious from the indentations so I fixed them up.

Program #1, ODE with trig functions.
Microsoft Fortran 4.01 compiled with
    fl /AM /4I4 /Ox y.for     
took 63 sec.

MicroWay NDP Fortran (a real 32 bit compiler, uses 32 bit mode)
    f77 -n2 -n3 -OLM y.for
took 34.6 sec.

Program #2, matrix operations; lots of loops
Microsoft Fortran 4.01 compiled with
     fl /AH /4I2 /Ox z.for
took 10.8 sec.

MicroWay NDP Fortran 
     f77 -n2 -n3 -OLM z.for
took 8.2 sec.

The results show that the 387 is slower for trig functions, better for
some other things.  Also, that a good 20Mhz 386-386 would be faster
than a Mac even for trig functions, but a real close call. It also
shows that a real 32 bit system will beat a 16 bit one (Microsoft
Fortran is basically 16 bit, NDP is all 32 bit). It is probably fair
to say that the speed ratios are quite different for the 68020 vs
the 80386 than for the 68881 vs the 80387. On Dhrystones, an integer-
string-subroutine call benchmark any respectable 386 system will
beat a MacII by about a factor of three (see comp.arch for proof).
These benchmarks were all REAL*4.  Changing to REAL*8 changes the results:
(NDP results) Problem 1 goes from 34.6 to 27.6. Problem 2 goes
from 8.2 to 10.2. That's right, the first one, with the trig functions
goes FASTER in REAL*8. Substantially faster.         

What this REALLY shows is that if you want to decide whether to buy
a MacII or a 386 on the basis of doing scientific or engineering
calculations in Fortran, you should benchmark a copy of the exact
problem you want to run most often.
Doug McDonald (mcdonald@uxe.cso.uiuc.edu)