@31 #1123 8-Bit Benchmarks with Primes Sieve I have got the following timing results using the primes sieve: BBC B 2.0 MHz 6502 100s Basic II BBC B + Z80 Tube 3.0 MHz Z80 83s BBCBasic(Z80) 2.20j BBC Master 3.0 MHz 65C12 76s Basic IV BBC Master + 6502 Tube 4.0 MHz 65C12 51s Basic IV Master Compact 3.0 MHz 6502 75s Basic &40 Amstrad NC 100 ??? MHz Z80 127s BBCBasic(Z80) 3.11 I use the following program to time implementations of BBC Basic. It is designed to test the speed of the interpreter, *not* the operating system. It has been finely tweeked to give a speed compared to a 2MHz BBC B, and must be entered *EXACTLY*. 10REM > ClockSp 20REM Calculate CPU clock speed 30PRINT"BBC BASIC CPU Timing Program" 40T%=TIME:REPEATUNTILTIME>T%+50 50B=1:B%=1:C=1000:C%=1000:D=5100:D%=5100:Z=0:Z%=0 60PRINT"Real REPEAT loop ";:T%=TIME:A=Z:REPEATA=A+B:UNTILA>C:T%= TIME-T%:PROCp(40800/T%) 70PRINT"Integer REPEAT loop ";:T%=TIME:A%=Z%:REPEATA%=A%+B%:UNTILA% >C%:T%=TIME-T%:PROCp(24000/T%) 80PRINT"Real FOR loop ";:T%=TIME:FORA=Z TO D STEPB:NEXT:T%=TIME -T%:PROCp(51000/T%) 90PRINT"Integer FOR loop ";:T%=TIME:FORA%=Z% TO D% STEPB%:NEXT:T%= TIME-T%:PROCp(17800/T%) 100PRINT"Floating-Point Test "; 110A=1:T%=TIME:FORJ%=1 TO 29:A=TAN(ATN(EXP(LN(SQR(A*A)))))+1:NEXT:T%= TIME-T%:PROCp(66500/T%) 120PRINT"Ackermann Recursion "; 130M%=3:T%=TIME:FORN%=1 TO 3:Z%=FNAck(M%,N%):NEXT:T%=TIME-T%:PROCp( 254500/T%) 140PRINT"Combined Average ";:PROCp(FNspeed) 150PRINT'"Compared to a BBC B running at 2.00MHz" 160END 170: 180DEFFNAck(M%,N%) 190IF M%=0:=N%+1 200IF N%=0:=FNAck(M%-1,1) 210=FNAck(M%-1,FNAck(M%,N%-1)) 220DEFPROCp(T%):PRINT"Speed: ";T%DIV100;".";RIGHT$("0"+STR$(T%),2); "MHz":ENDPROC 230: 240 This is calibrated against a 250 BBC model B with no second 260 processor, running BASIC II 270 and with almost all interupts 280 turned off using: 290 ?&FE4E=&3F 300 This gives 2.00MHz. 310: 320 Savage Floating Point test and 330 Ackermann Recursion test added 340-Mar-93, based on A&B Jan 90. 350: 360DEFFNspeed:LOCAL A,B,C,D,Z,A%,B%,C%,D%,U%,V%,W%,X%,Y%,Z% 370T%=TIME:REPEATUNTILTIME>T%+50 380B=1:B%=1:C=1000:C%=1000:D=5100:D%=5100:Z=0:Z%=0 390T%=TIME:A=Z:REPEATA=A+B:UNTILA>C:T%=TIME-T%:U%=(40800/T%) 400T%=TIME:A%=Z%:REPEATA%=A%+B%:UNTILA%>C%:T%=TIME-T%:V%=(24000/T%) 410T%=TIME:FORA=Z TO D STEPB:NEXT:T%=TIME-T%:W%=(51000/T%) 420T%=TIME:FORA%=Z% TO D% STEPB%:NEXT:T%=TIME-T%:X%=(17800/T%) 430A=1:T%=TIME:FORJ%=1 TO 29:A=TAN(ATN(EXP(LN(SQR(A*A)))))+1:NEXT:T% =TIME-T%:Y%=(66500/T%) 440=(U%+V%+W%+X%+Y%)DIV5 450REM Returns CPU speed*100 This gives the following figures: BBC B 1.99MHz BBC B + Z80 Tube 2.69MHz Master 2.68MHz Master + 6502 Tube 4.03MHz Compact 3.16MHz Archimedes A5000 >25MHz (from memory) Amstrad NC100 1.70Hz The one thing it doesn't test is string handling speed. I've been thinking of adding just such a test. Of course, with the Risc-PC, all of Basic will be in the code cache, and all of the program will fit in the data cache, so the results will probably be astronomical. J.G.Harston (BBC PD Library) - jgh@digibank.demon.co.uk 70 Camm Street, Walkley, Sheffield, S6 3TR