More NQueens benchmark results Message #1 Posted by Egan Ford on 26 July 2007, 7:31 p.m.
I stumbled across this http://www.hpmuseum.org/cgisys/cgiwrap/hpmuseum/articles.cgi?read=700 from a recent post and thought I'd contribute a few more results. I am unsure who tracks/updates this list.
71B/FORTH (about 3x faster than 71B/BASIC, faster than 50g UserRPL):
Output:
S=876 IN 46.27 SEC
Code:
: NQUEENSF ;
FVARIABLE TIMER
: STARTTIMER CLOCK TIMER STO ;
: DISPLAYTIMER CLOCK TIMER RCL F STD F. ." SEC" ;
8 CONSTANT RR
VARIABLE SS
VARIABLE XX
VARIABLE YY
CREATE AA RR 1 + ALLOT
: RCLAA @ 2 * AA + C@ ;
: STOAA @ 2 * AA + C! ;
: NQCORE
0 SS !
0 XX !
BEGIN
1 XX +! RR XX STOAA
BEGIN
1 SS +!
XX @ YY !
BEGIN YY @ 1 > WHILE
1 YY +!
XX RCLAA YY RCLAA  DUP
0 = SWAP ABS XX @ YY @  = OR IF
0 YY !
BEGIN XX RCLAA 1  DUP XX STOAA 0 = WHILE
1 XX +!
REPEAT
THEN
REPEAT
YY @ 1 = UNTIL
RR XX @ = UNTIL
;
: NQUEENS
STARTTIMER
NQCORE
." S=" SS @ . ." IN "
DISPLAYTIMER CR
;
71B/RPN (HP41 emulator, about 4x faster than 41CX):
Output:
S=876 IN 269.87 SEC
Code:
LBL "NQ41"
FIX 0
CLRG
TIME
HR
STO 12
8
STO 11
LBL 00
RCL 00
RCL 11
X=Y?
GTO 04
ISG 00
DEG
STO IND 00
LBL 01
ISG 10
DEG
RCL 00
STO 09
LBL 02
DSE 09
DEG
RCL 09
X=0?
GTO 00
RCL IND 00
RCL IND 09

X=0?
GTO 03
ABS
RCL 00
RCL 09

X#Y?
GTO 02
LBL 03
DSE IND 00
GTO 01
DSE 00
GTO 03
LBL 04
"S="
ARCL 10
"} IN "
TIME
HR
RCL 12

3600
*
FIX 02
ARCL X
"} SEC"
AVIEW
RTN
