User RPL speed



Post: #4

For sure some of you remember the thread about the Calculator Benchmark. A legitimate criticism was not having a structured version of the test algorithm for languages without GOTO command or if slower with unstructured code. Meanwhile I have added an accurate structured version of the test using the same algorithm as the unstructured one. If a language allows both versions, you will find the faster version in the table now.

This is the accurate User RPL implementation:

<< 8. 0. 0. 0. { } -> R S X Y A
<< CLEAR TICKS
1. R START 0. NEXT R ->LIST 'A' STO
DO
'A' 'X' INCR R PUT
DO
'S' INCR DROP
X 'Y' STO
WHILE Y 1. > REPEAT
A X GET A 'Y' DECR GET -
IF DUP 0. == SWAP ABS X Y - == OR THEN
0. 'Y' STO
'A' X A X GET 1. - PUT
WHILE A X GET 0. == REPEAT
'A' 'X' DECR A X GET 1. - PUT
END
END
END
UNTIL Y 1. == END
UNTIL X R == END
TICKS SWAP - B->R 8192. /
S
>>
>>

After running the program, it returns the test value of 876 for correct executing and the time needed, if I am right that 8192 ticks are one second on all RPL calculators. The typical execution speed of the HP-50G is 90.3 seconds after 10 runnings.

It would be nice, if somebody can test a RPL calculator with other hardware.

Hardware Overview:
------------------
Saturn 0.640 MHz: HP-28C
Saturn 1 MHz: HP-28S
Saturn 2 MHz: HP-48 S/SX
Saturn 3.7-4 MHz: HP-48 G/GX/G+
Saturn 4 MHz: HP-49G
ARM9 48 MHz: HP-48GII
ARM9 75 MHz: HP-49G+ / HP-50G

Edited: 6 June 2007, 9:04 a.m.


Post: #5

I own a HP-28s. TICKS is new to me. Is it implemented in first generation User-RPL or is only available via Sys-RPL?


Post: #6

On the HP-28S you should use #11CAh SYSEVAL. For instance, in interactive mode,

#11CAh SYSEVAL ENTER
#11CAh SYSEVAL ENTER
SWAP - 8192 /

will return the elapsed time between the two ENTER presses.

Regards,

Gerson.

P.S.:

I think replacing TICKS with #11CAh SYSEVAL in Xerxe's program might work.


Edited: 6 June 2007, 10:10 a.m.

Post: #7

If Gersons tip doesn't work, you can try this version using a stopwatch:

<< 8. 0. 0. 0. { } -> R S X Y A
<< CLEAR
1. R START 0. NEXT R ->LIST 'A' STO
DO
'A' 'X' INCR R PUT
DO
'S' INCR DROP
X 'Y' STO
WHILE Y 1. > REPEAT
A X GET A 'Y' DECR GET -
IF DUP 0. == SWAP ABS X Y - == OR THEN
0. 'Y' STO
'A' X A X GET 1. - PUT
WHILE A X GET 0. == REPEAT
'A' 'X' DECR A X GET 1. - PUT
END
END
END
UNTIL Y 1. == END
UNTIL X R == END
440. .1 BEEP
S
>>
>>

Edited: 6 June 2007, 12:03 p.m.

Post: #8

Well, I just ran it on my 48SX, and I got the following output


2:            368.674194336
1: 876


I assume that the first time is the number of seconds used?

Post: #9

Thanks for testing. I have updated the table with your result.

Yes, the 876 means that the program works correctly and the second value on the stack is the execution time in seconds. Note that it is important to use the decimal point at all constants in the program for faster execution.


Post: #10

Yup. I typed it in exactly as presented above.


Forum Jump: