[comp.sys.amiga.programmer] BYTE sieve.c benchmark

Dennis_Grant@cmr001.bitnet (03/01/91)

     To quickly go over the contents of my last post on the subject:
I typed in the sieve.c benchmark program from a back isuue of BYTE (sorry,
don't have mag with me right now, so I can't tell you the date, but it has
a big picture of a clock on the front with the heading "BYTE's new bench-
marks"), and couldn't figure out how an IBM PC-XT could print out 1600000
prime numbers in 294 or so seconds, when my Amiga version using the same
source code was still running 5 hours later.

     It was pointed out to me that the IBM has simpler text display
hardware, so that an IBM text display should print out faster than an Amiga
graphic font display.

     True, but it turns out that wasn't the problem. Upon re-examining the
source code, I discovered that the printf in the main loop that prints out
each prime number as it is calculated IS ACTUALLY COMMENTED OUT. *blush*
The comment markers in the listing are at the far extremes of the page,
and are very easy to miss. (as I did) Why BYTE even decided to add that
line, I'm not sure, but the program runs MUCH faster without it.

     I wrote a time check into the program ( a call to time() at the start
and end of the outer loop, printf the difference) and a 100 iteration sieve
took 68 seconds. Further examination of the source code revealed that I had
mistakenly declared a variable as an int instead of a char - fixing this
gave a sieve time of 32 seconds. This is the final answer.

     To satisfy my curiosity, I put the printf back into the main loop to
see how long it would take to run. Answer: 4.7 hours. Ick!

     In conclusion: A stock Amiga 2000 takes 32 seconds to perform a 100
iteration sieve. Compare this to 294 seconds for a PC-XT, and to 27 seconds
for an IBM PS/2 model 80. (Which is a 20 MHz '386, I think) Not bad, eh?

-------------------------------------------------------------------------------
  Dennis Grant   3rd year CS student at Le College Militaire Royal de St-Jean
  DETUD595@CMR001.BITNET
  How much do I love thee? My accumulator overflows!

amgreene@athena.mit.edu (Andrew Marc Greene) (03/01/91)

What are the results if you turn multitasking off?  I assume your
32 seconds includes time spent in the kernel doing context switching,
etc.