| This Sieve of Eratosthenes program works with variable size | arrays. It is a straight forward extension of the original | Gilbreath version ( Gilbreath, Jim. "A High-Level Language | Benchmark." BYTE, September 1981, p. 180, and also Gilbreath, | Jim and Gary. "Eratosthenes Revisited: Once More Through the | Sieve." BYTE January 1983, p. 283 ). Maximum array size is | currently set at 2.56 MBytes but this can be increased or | decreased by changing the program LIMIT constant. NSIEVE | provides error checking to ensure correct operation. NSIEVE | results won't generally agree with the Gilbreath Sieve | results. NSIEVE, and Sieve, are programs designed | specifically to generate and printout prime numbers (positive | integers which have no other integral factor other than | itself and unity, as 2,3,5,7,11, ... ). NSIEVE does not | conduct the 'typical' instructions one might expect from the | mythical 'typical program'. NSIEVE results can be used to | gain a perspective into the relative performance of different | computer systems, but they can not be used in isolation to | categorize the general performance capabilities of any | computer system. | The program uses a maximum array size of 2.56 MBytes. You can | increase or lower this value by changing the 'LIMIT' define | from 9 to a higher or lower value.
The Forth NSIEVE benchmark shows the quality of your compiler's integer code as compared to that of an optimizing "C" compiler. Results for a large number of C compilers on a variety of systems are available in the .tbl file.
Note the heavy influence of a good memory subsystem, as evidenced by the sometimes disastrous discrepancy between High and Low MIPS numbers.
Do not overestimate the importance of NSIEVE performance. The inner loop of this program handles bytes, which is rather inefficient, especially on the Athlon.
FORTH> main Sieve of Eratosthenes (scaled to 10 iterations) Version 1.2b, 26 Sep 1992 Array Size Number Last Prime Linear RunTime MIPS (Bytes) of Primes Time(msec) (msec) 8191 1899 16381 25 25 66.322 10000 2261 19997 30 32 63.497 20000 4202 39989 61 76 54.164 40000 7836 79999 122 164 50.812 80000 14683 160001 244 343 49.153 160000 27607 319993 488 707 48.214 320000 52073 639997 976 1539 44.758 640000 98609 1279997 1953 3224 43.154 1280000 187133 2559989 3906 6675 42.078 2560000 356243 5119997 7813 13786 41.113 Relative to 10 iterations and the 8191 Array Size: Average RunTime = 39 (msec) High MIPS = 63.49 Low MIPS = 41.11
The NSIEVE result puts iForth in the following company (NSIEVE.tbl):
CPU High Low System OS CPU (MHz) MIPS MIPS REF ### ------------------- ----------------- ------- ------ ------ ----- ---- 110 DEC 3000/500 AXP OSF/1 T1.2-2 (R5) 21064 150 73.2 26.0 46 111 HP 9000/750 HP-UX 9.05 PA7000 66 73.2 17.0 80 112 IBM RS/6000 250 AIX 3.2.5 PowerPC 60 73.2 16.7 74 113 Dell XPS Pro 200n NT 3.51 No opt Pentium6 200 72.6 27.7 113 114 SGI Indy PC Irix 5.1.1 R4000 100 72.1 14.9 67 115 HP 9000/730 HP-UX 9.0 PA-RISC 66 72.0 17.2 30 116 IBM RS/6000 370 AIX 3.2.4 RISC --- 71.0 24.6 70 117 IBM RS/6000 370 AIX 3.2.4 RISC --- 69.9 24.3 70 118 IBM RS/6000 370 AIX 3.2.4 RISC --- 69.2 24.5 70 119 HP 9000/730 4.3 BSD PA-RISC 66 68.1 14.8 34 120 SGI Indigo2 Extreme Irix 4.0.5H R4000 100 66.8 11.1 79 --- ---------------------------------------------------------------------- P54C NT 4.0 Pentium 166 66.3 41.1 --- ---------------------------------------------------------------------- 121 HP 9000/712 HP-UX 9.05 PA7100LC 60 66.2 18.2 80 122 HP 9000/730 HP-UX 8.07 PA-RISC 66 65.9 16.6 10 123 HP 9000/730 HP-UX 8.07 PA-RISC 66 65.9 16.2 22 124 SGI Iris Crimson ----------------- R4000 100 65.4 13.3 16 125 Sun SS 10/41 ----------------- SSPARC 40 65.3 13.6 26 126 SGI Iris Crimson Irix 4.0.3 R4000 100 64.8 13.1 12 127 HP 9000/730 4.3 BSD PA-RISC 66 63.1 14.7 34 128 HP 9000/730 ----------------- PA-RISC 66 62.8 16.4 18 129 SGI Indigo2 Extreme Irix 4.0.5H R4000 100 62.8 10.4 79 130 486DX4/100 Windows 95 80486DX4 100 62.6 37.0 107 131 486DX4/100 Windows 95 80486DX4 100 62.6 36.5 107free counter