8-Queens Benchmark
05-23-2016, 06:08 PM (This post was last modified: 05-24-2016 04:09 AM by Hlib.)
Post: #1
 Hlib Member Posts: 242 Joined: Jan 2015
8-Queens Benchmark
I had doubts concerning the speed of some calculators. For FX-2.0 the program doesn't work (S=876???). Also results
- 14:10 SRP-400G Formula/List
- 5:47 SRP-320G Formula/Array
- 2:15 FX-6300G Formula/Array
are quite doubtful.
I don't understand the real programming, but I am going to write algorithm "8-Queens" for testing of calculators. I have one question: it is calculation only for one option, or for all 92 options for 8 Q at 8x8?

<<How many integers (from 1 to 9999) are evenly divisible by the number of letters in their name?
...For you HP50 fans, I expect to see a one-line RPL program!... (from Don Shepherd)>> http://www.hpmuseum.org/forum/thread-288...=challenge

So, I wrote not bad algorithm :-).
05-24-2016, 02:28 PM
Post: #2
 xerxes Member Posts: 145 Joined: Jun 2014
RE: 8-Queens Benchmark
Hello Hlib,

please allow me to resolve a misunderstanding. The value 876 represents the number of nodes evaluated in
the iterative backtracking search tree for the first solution. So the FX-2.0 version seems to be correct.

There are two problems regarding the SRP-400G. The GOTO command is not usable due to an interpreter bug,
that treats the GOTO like a nested GOSUB. This bug allows 6 GOTO jumps in a program only. The next very
time consuming problem is the not suppressable print of a list while assigning. This circumstances make
the SRP-400G much slower than necessary, especially if indirect adressing is needed. More details here.

I've checked the results of the FX-6300G and the SRP-320G, but I cannot see the reason for your doubts.
May be I overlooked a detail.

Calculator Benchmark
05-27-2016, 08:14 PM (This post was last modified: 05-27-2016 08:32 PM by Hlib.)
Post: #3
 Hlib Member Posts: 242 Joined: Jan 2015
RE: 8-Queens Benchmark
(05-24-2016 02:28 PM)xerxes Wrote:  Hello Hlib,

please allow me to resolve a misunderstanding. The value 876 represents the number of nodes evaluated in
the iterative backtracking search tree for the first solution. So the FX-2.0 version seems to be correct.

There are two problems regarding the SRP-400G...

Hi, xerxes!
It is huge work to check so many calculators. I will answer You in June after research of Your algorithm for calculators. To me it seems that it is easier to write the new program, than to understand initial. I work at a factory as the slave, so I can't finish the researches of this program very quickly.
06-25-2016, 06:39 PM
Post: #4
 Hlib Member Posts: 242 Joined: Jan 2015
RE: 8-Queens Benchmark
I decided to fill absence of the program for SRP-325G (HP-9G) for Calculator Benchmark. In algorithm with Goto-Lbl it is impossible to improve anything. Here I tried to correct defect of the calculator connected with buggy Goto.
Code:
 R=8 ; S=0 ; FOR ( X=1 ; X≤R ; X++ )   { A[X]=R ; S++ ;     FOR ( Y=X-1 ; Y≥1 ; Y-- )       { T=A[X]-A[Y] ;         IF ( T(X-Y-ABS(T))==0 )         THEN { FOR ( U=X ; U≥1 ; U-- )                       { IF ( --A[U]≥1 )                       THEN { U=0 ; S++ ; Y=X } ;                        ELSE { X-- }                     } ;             IF ( X==0 ) THEN { X=R ; Y=1 }         }     } } ; PRINT S ; END
S=876, time(for SRP-325G)=10:40
a8 b4 c1 d3 e6 f2 g7 h5
06-26-2016, 06:47 PM
Post: #5
 xerxes Member Posts: 145 Joined: Jun 2014
RE: 8-Queens Benchmark
Thanks for your effort testing the SRP-325G and the interesting adaption. I'll update the list with your result.
It's true that it was a huge work making this list, but this was only possible with the help of so many nice people.

Calculator Benchmark
06-29-2016, 11:41 AM (This post was last modified: 06-29-2016 05:27 PM by mtern.)
Post: #6
 mtern Junior Member Posts: 12 Joined: Jun 2016
RE: 8-Queens Benchmark
(06-26-2016 06:47 PM)xerxes Wrote:  Thanks for your effort testing the SRP-325G and the interesting adaption. I'll update the list with your result.
It's true that it was a huge work making this list, but this was only possible with the help of so many nice people.

Hello Xerxes,
if you like, you could update your list to include also:
- Free42 on Galaxy S6+edge with 0,0264 secs
- Free42 on Huwaei Play Mini with 0,067 secs
- HP Prime emulator on Galaxy S6+edge with 0,0657 secs

it seems free42 on G6 is 26000 times faster than original hp42s.
And that the Prime emulator on G6 is 13 times faster the original Prime.
06-30-2016, 12:04 PM
Post: #7
 xerxes Member Posts: 145 Joined: Jun 2014
RE: 8-Queens Benchmark
Hello mtern,
only 26000 times faster? How disappointing (just kidding). Thanks for the interesting comparison, but
I avoid to include emulator results. One reason is that the speed strongly depends on the used hardware
and it's not really a physical calculator. One exception is the Commodore C64, because I wanted to have
a 6502 system in the list for a better comparison of the assembly languages of the CPUs and I assume
the same speed of the C64 and the Panasonic HHC for Microsoft BASIC. Unfortunately I was not able to
find a HHC to confirm this and to test Snap Forth and Snap BASIC.

Calculator Benchmark
06-30-2016, 03:24 PM
Post: #8
 Paul Berger (Canada) Senior Member Posts: 533 Joined: Dec 2013
RE: 8-Queens Benchmark
I have a Panasonic HHC with the Snap BASIC ROM, and could try it for you if you could provide me with a program listing. Its likely it will need to be modified as Snap BASIC has a few idiosyncrasies.

Paul.
06-30-2016, 08:14 PM (This post was last modified: 06-30-2016 08:17 PM by xerxes.)
Post: #9
 xerxes Member Posts: 145 Joined: Jun 2014
RE: 8-Queens Benchmark
Hello Paul,
I would be grateful to you, if you can test the Snap BASIC successfully. As far as I know, Snap
BASIC is programmed in Snap Forth. If so, I expect a slower result compared to the C64.
This is the BASIC version of the benchmark program:
Code:
  10  CLEAR:DEFINT A-Z         (DEFINT used if faster)   20  R=8                      (R>=1)   30  REM DIM A(R)             (DIM used if necessary)   40  IF X=R THEN 180   50  X=X+1   60  A(X)=R   70  S=S+1   80  Y=X   90  Y=Y-1  100  IF Y=0 THEN 40  110  T=A(X)-A(Y)  120  IF T=0 THEN 140  130  IF X-Y<>ABS(T) THEN 90  140  A(X)=A(X)-1  150  IF A(X)<>0 THEN 70       (<>0 omitted if possible)  160  X=X-1  170  IF X<>0 THEN 140         (<>0 omitted if possible)  180  PRINT S  >RUN  >876 (Nodes evaluated)  >_

Calculator Benchmark
07-02-2016, 02:24 AM
Post: #10
 Paul Berger (Canada) Senior Member Posts: 533 Joined: Dec 2013
RE: 8-Queens Benchmark
Results for Panasonic HHC RL-H1800 with SnapBasic Using all integer variables 89 seconds, but using default real variables the run time jumps to 199 seconds, a very significant increase. The keyboard on the HHC has to be one of the all time bad keyboard designs, and not just for the size and shape of the keys but also for the keyboard layout.

I also ran the program you supplied on my 9835A and it completed in 21 seconds using real variables, not bad for a machine from the 70s. It is a machine where using real variables is faster than integer due to it having hardware floating point.

Paul.
07-02-2016, 06:39 PM (This post was last modified: 07-02-2016 06:42 PM by xerxes.)
Post: #11
 xerxes Member Posts: 145 Joined: Jun 2014
RE: 8-Queens Benchmark
Thank you for testing this strange device in spite of it's not very ergonomic keyboard.
On C64 BASIC the reals are also faster than integers, if the tested results that I got
are correct, but surely for another reason. Now it's time to replace the C64 with the HHC.

Calculator Benchmark
07-02-2016, 10:08 PM
Post: #12
 Paul Berger (Canada) Senior Member Posts: 533 Joined: Dec 2013
RE: 8-Queens Benchmark
Is your collected list of results available somewhere?
07-03-2016, 09:56 AM
Post: #13
 xerxes Member Posts: 145 Joined: Jun 2014
RE: 8-Queens Benchmark
Yes, it's in the old articles forum here.

Calculator Benchmark
07-03-2016, 04:22 PM
Post: #14
 Accutron Member Posts: 111 Joined: Aug 2014
RE: 8-Queens Benchmark
(07-02-2016 02:24 AM)Paul Berger (Canada) Wrote:  I also ran the program you supplied on my 9835A and it completed in 21 seconds using real variables, not bad for a machine from the 70s.

I wonder how that compares to HPL on the 9825.
07-03-2016, 06:11 PM
Post: #15
 Paul Berger (Canada) Senior Member Posts: 533 Joined: Dec 2013
RE: 8-Queens Benchmark
(07-03-2016 04:22 PM)Accutron Wrote:
(07-02-2016 02:24 AM)Paul Berger (Canada) Wrote:  I also ran the program you supplied on my 9835A and it completed in 21 seconds using real variables, not bad for a machine from the 70s.

I wonder how that compares to HPL on the 9825.

Yes that would be interesting the processor in the 9825 is essentially the same, the big difference is the extended bank switching scheme built into the CPU used in the 9835 and 9845 B&C. I could try HPL on a 9816 and even a 9920U.

Paul.
07-04-2016, 02:10 AM
Post: #16
 Accutron Member Posts: 111 Joined: Aug 2014
RE: 8-Queens Benchmark
(07-03-2016 06:11 PM)Paul Berger (Canada) Wrote:  I could try HPL on a 9816 and even a 9920U.

I have a 9825A but no experience with HPL. If you or somebody else could put up the routine, I can run it.
07-04-2016, 04:43 AM
Post: #17
 Paul Berger (Canada) Senior Member Posts: 533 Joined: Dec 2013
RE: 8-Queens Benchmark
(07-04-2016 02:10 AM)Accutron Wrote:
(07-03-2016 06:11 PM)Paul Berger (Canada) Wrote:  I could try HPL on a 9816 and even a 9920U.

I have a 9825A but no experience with HPL. If you or somebody else could put up the routine, I can run it.

Well I just wrote a HPL program for 9816, I think the syntax is the same as the HPL for the 200 series was designed to help people to move from 9825 over to 9816, 9826, and 9836. I would need to remove the time functions as they are not supported on the 9825. I still want to optimize the program, when I am done I will post my program. HPL is a little odd but not too difficult. The optimized program runs in 8.06 seconds on the 9816 with a 8MHz 68000 CPU. The HPL system will not boot on my 9920U it looks like it will not work with machines that have 68010 processors.
Post: #18
 Paul Berger (Canada) Senior Member Posts: 533 Joined: Dec 2013
RE: 8-Queens Benchmark
Here is the HPL program that I used, you should be able to key this in directly on a 9825, the syntax for the series 200 HPL is identical but has a couple extensions. This is no surprise as it seems the 200 series HPL was designed to help customers move from a 9825 to a series 200 system. I hope the arrows come out correctly the first line should be 8 right arrow R. The case is important so type it in exactly as shown. The right arrow would seem to be on the numeric keypad of the 9825. I didn't use an array as the manual says the "r" variables, which are like a 1 dimensional array, are faster. It does not appear that HPL has any concept of integers only real numbers. The optimizations applied reduce the run time to 7.42 seconds.

Code:
 0:    8⟶R 1:   "L1":if X=R;gto "L5" 2:   X+1⟶X;R⟶rX 3:   "L2":S+1⟶S;X⟶Y 4:   "L3":Y-1⟶Y 5:   if Y=0;gto "L1" 6:   rX-rY ⟶T;if T=0;gto "L4" 7:   if X-Y<>abs(T);gto "L3" 8:   "L4":rX-1 ⟶rX;if rX;gto "L2" 9:   X-1 ⟶X;if X;gto "L4" 10: "L5":prt S 11: end

While I had the 9816 out I tried the program in version 5.1 of Workstation BASIC using integers if completes in 4.27 seconds and real variables took 6 Seconds. At one time I was told that HPL was faster than BASIC on these systems, however that does not appear to be the case. I also ran the same BASIC program on my 9920U with 12.5MHz 68010 Integer 2.32 Secs. Real 3.19 Secs. and on my 320 with 16.67MHz 68020 Integer 1.56 secs. Real 1.73. It may seem surprising that the times using real variables are slower for the 9920U and the 320 since they both have hardware floating point, however the stumbling block is likely the array indices, as it is noted in the manual that if they are real numbers they must be converted to integers before the array variable may be accessed.
07-10-2016, 03:21 AM (This post was last modified: 07-10-2016 03:34 AM by Accutron.)
Post: #19
 Accutron Member Posts: 111 Joined: Aug 2014
RE: 8-Queens Benchmark
Timing it with a stopwatch, I got 12.07, 12.12, 12.08, but of course there was a small ~0.1 second delay between when the program finished and when I mashed the stop button on the watch, so the completion time is pretty much exactly 12 seconds. Well, to be more specific, it's 12 seconds before I get an Error 15 at Line 10 - printer out of paper Changing the prt to a dsp in Line 10 gives the result 876.00 on the line display, which I believe is the correct answer.

I did run into a couple syntax errors while entering the program. In Line 1, it looks like there should be quotes around L5, and in Line 8 the colon should be a semicolon? That's where the debug cursors were placed, at least.
07-10-2016, 05:09 PM
Post: #20
 Paul Berger (Canada) Senior Member Posts: 533 Joined: Dec 2013
RE: 8-Queens Benchmark
Right you are I will fix the listing....
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)