Speed Comparison Message #1 Posted by Xerxes on 29 Jan 2007, 1:32 p.m.
I am working on a calculator benchmark to test the speed of the programming language and not the mathematical functions. The program searches a position for 8 queens on a chessboard without attackting each other by brute force. I have many results for Casio and Sharp calculators but only one HP. Can somebody please test it on a HP-71B or a HP-75C/D? Of course results of other calculators are welcome.
5 CLEAR
10 R=8
20 REM DIM A(R)
30 S=0
40 X=1
50 A(X)=R
60 IF X=R THEN 200
70 X=X+1
80 A(X)=R
90 S=S+1
100 Y=X
110 Y=Y-1
120 IF Y=0 THEN 60
130 T=A(X)-A(Y)
140 IF T=0 THEN 160
150 IF X-Y<>ABS(T) THEN 110
160 A(X)=A(X)-1
170 IF A(X)<>0 THEN 90
180 X=X-1
190 IF X<>0 THEN 160
200 PRINT S
210 BEEP 1
On some calculators you can use the variables A-Z as an array a[], so the DIM command in line 20 is not necessary then. The result for S should be 875 if the program runs correctly.
The version for the HP-41CV:
LBL_A
CLX STO_11
8 STO_12 STO_01
1 STO_00
LBL_00
RCL_00 RCL_12
X=Y? GTO_04
ISG_00 DEG
STO_IND_00
LBL_01
ISG_11 DEG
RCL_00 STO_10
LBL_02
DSE_10 DEG
RCL_10 X=0? GTO_00
RCL_IND_00 RCL_IND_10 -
X=0? GTO_03
ABS RCL_10 + RCL_00 -
X<>0? GTO_02
LBL_03
DSE_IND_00 GTO_01
DSE_00 GTO_03
LBL_04
RCL_11
BEEP
The HP-41CV takes 1120 sec for this program. I guess the HP-71/75 are much faster.
If somebody wants to test it on FX-602P:
AC Min1F
8 MinF Min01
1 Min00
LBL0
MR00 x=F GOTO4
ISZ
MRF IND Min00
LBL1
1 M+1F
MR00 Min10
LBL2
1 M-10
MR10 x=0 GOTO0
IND MR00 - IND MR10 =
x=0 GOTO3
ABS + MR10 - MR00 =
x=0 GOTO3 GOTO2
LBL3
IND DSZ GOTO1
DSZ GOTO3
LBL4
MR1F
FX-603P : 165 sec
FX-603P [turbo 2.0]: 82.9 sec
Edited: 31 Jan 2007, 12:47 p.m. after one or more responses were posted
|