The Museum of HP Calculators

HP Forum Archive 17

[ Return to Index | Top of Index ]

User RPL speed
Message #1 Posted by Xerxes on 6 June 2007, 9:01 a.m.

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.

      
Re: User RPL speed
Message #2 Posted by Frank Rottgardt on 6 June 2007, 9:11 a.m.,
in response to message #1 by Xerxes

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?

            
Re: User RPL speed
Message #3 Posted by Gerson W. Barbosa on 6 June 2007, 10:06 a.m.,
in response to message #2 by Frank Rottgardt

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.

            
Re: User RPL speed
Message #4 Posted by Xerxes on 6 June 2007, 12:02 p.m.,
in response to message #2 by Frank Rottgardt

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.

      
Re: User RPL speed
Message #5 Posted by joey Bernard on 6 June 2007, 10:27 a.m.,
in response to message #1 by Xerxes

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?
            
Re: User RPL speed
Message #6 Posted by Xerxes on 6 June 2007, 11:18 a.m.,
in response to message #5 by joey Bernard

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.

                  
Re: User RPL speed
Message #7 Posted by Joey Bernard on 7 June 2007, 10:11 a.m.,
in response to message #6 by Xerxes

Yup. I typed it in exactly as presented above.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall