[net.micro] Z-100 vs IBM-AT Challenge Update

GUBBINS@RADC-TOPS20.ARPA (Gern) (05/17/85)

I propose that the perfect benchmark for computational throughput
be a prime numbers between 0 and something large (say 100K or 1M) program
written in MS-FORTRAN under PC/Z/MS-DOS.    I will even agree to using
either IBM's MS-FORTRAN compiler or the *.OBJ or better yet *.EXE
directly from the AT.

At college a long time ago (4 years...) my associates and I had The Great
Prime Numbers race on the college's IBM VM-370 4341 to prove which of
our favorite languages was faster.   They all were compiled languages.
BASIC won hands down over FORTRAN and Pascal..

Come on all you IBM-AT owners, any takers???

Cheers,
Gern
-------

fouts@AMES-NAS.ARPA (Marty) (05/17/85)

     No.  There is no such thing as a single "perfect" benchmark.
Especially for computational throughput.

     For example, the code attached to the end of this note is an
excelent example of a heavily optimized variation of one of the more
common prime number generator algorithms (which isn't the fastest,
provided you have enough memory).

     However, the only "computations" it does are integer divisions and
multiplies.  It doesn't do any floating point arithmetic.  

     I have done versions of this algorithm in many languages on 8, 16,
32 and 64 bit machines ranging in size from an SBC Z80 to a Cray 2.

     In fact, this version in C will run faster on a Vax 11/780 under
Berkeley 4.2 Unix than it will on a Cray X-mp 12 under COS, because on
the Cray X-mp, the time to load the program into memory greatly
dominates the time to do this computation.

     The point is, there isn't any single benchmark which will tell you
that machine A is better than machine in B, because at best "better"
(or faster) is a partial ordering and depends on the job mix.

     If you intend to use the machine to only do integer mulitply /
divide operations in a one to one mix, then perhaps prime number
generation is a good measure.

     Otherwise it is at best a rule of thumb estimator.

Marty


/*
 * Yet Another Prime number generator
 */

#define MAXPRIME 3300

#define MAXN 32767

int index,
    dividend,
    product,
    n = 5,
    nprime = 1,
    prime[MAXPRIME] = {2, 3};

main()
{
    for ( ; (nprime < MAXPRIME-1) && (n <= MAXN); n += 2) {
	for (index = 1, dividend = n ;
	     (index < nprime) && (dividend > prime[index]); index++)
	    if ((product = (dividend = n / prime[index]) * prime[index]) == n)
	        break;
	if (product != n)
	    prime[++nprime] = n;
    }
    printf("There are %d primes less than %d. The largest is %d.\n",
            nprime + 1, n, prime[nprime]);
}

----------

sambo@ukma.UUCP (Inventor of micro-S) (05/24/85)

earlier produces a 10% speed increase on the VAX 11/750
Expires: 
References: <10787@brl-tgr.ARPA>
Sender: 
Reply-To: sambo@ukma.UUCP (Inventor of micro-S)
Followup-To: 
Distribution: 
Organization: Univ. of KY Mathematical Sciences
Keywords: 

/*
 * Yet Another Prime number generator
 */

#define MAXPRIME 3300

#define MAXN 32767

int index,
    dividend,
    product,
    inc = 4, /* increment to add to n - oscillates between 2 and 4 */
    n = 5,
    nprime = 1,
    prime[MAXPRIME] = {2, 3};

main()
{
    /* note that n is never divisible by 3 because of how it is incremented */
    for ( ; (nprime < MAXPRIME-1) && (n <= MAXN); n += (inc = 4 - inc + 2)) {
	/* start with index = 2 instead of 1 to avoid dividing by three */
	for (index = 2, dividend = n ;
	     (index < nprime) && (dividend > prime[index]); index++)
	    if ((product = (dividend = n / prime[index]) * prime[index]) == n)
	        break;
	if (product != n)
	    prime[++nprime] = n;
    }
    printf("There are %d primes less than %d. The largest is %d.\n",
            nprime + 1, n, prime[nprime]);
}