The Museum of HP Calculators

HP Forum Archive 20

[ Return to Index | Top of Index ]

HP-41CL Calculator Benchmark
Message #1 Posted by Juergen Keller on 19 June 2011, 2:11 p.m.

I did some benchmarks for the HP-41CL as described in the Calculator Benchmark article. You'll find the results in PDF format here. As expected the MCODE benchmark shows a linear speed-up because there is no display output (the 41CL has to switch back to original speed for some I/O operations). With keystroke programming in TURBO50 mode the 41CL is as fast as a Commodore 64, programmed in BASIC. With MCODE in TURBO50 mode, the 8-Queen problem is solved in 1/4 sec!

      
Re: HP-41CL Calculator Benchmark
Message #2 Posted by Xerxes on 19 June 2011, 6:15 p.m.,
in response to message #1 by Juergen Keller

I was curious to see the difference of the speed modes since discovering the 41CL some times ago. Thank you for your effort and the nice contribution.

            
Re: HP-41CL Calculator Benchmark
Message #3 Posted by Juergen Keller on 20 June 2011, 3:15 a.m.,
in response to message #2 by Xerxes

I have to thank you for updating the article.

                  
Re: HP-41CL Calculator Benchmark
Message #4 Posted by exschr on 20 June 2011, 3:46 a.m.,
in response to message #3 by Juergen Keller

Even though "TurboX" means "normal speed", TurboX could be misleading to the unaware!
My propose instead of:
17:58 HP-41CL Keystroke / RPN / TurboX Mode

to change to:
17:58 HP-41CL Keystroke / RPN / Turbo off

                        
Re: HP-41CL Calculator Benchmark
Message #5 Posted by Xerxes on 20 June 2011, 2:07 p.m.,
in response to message #4 by exschr

I think you are right, but in the list "Turbo" usually stands for speed up by hardware modification, so I changed it to "TurboX Mode x1.0" to make it more clear what TurboX means.

            
Re: HP-41CL Calculator Benchmark
Message #6 Posted by Oliver Unter Ecker on 21 June 2011, 6:33 a.m.,
in response to message #2 by Xerxes

Hi Xerxes,

Here's a couple of additions to your nice benchmark doc, in, I hope, ready-to-paste format:

 -       4.36      ND1 (v1.4)       RPL (UserRPL from HP-50g)
 -
 -       2.78      ND1 (v1.4)       RPL+
 -
 -       0.00338   ND1 (v1.3.9)     JavaScript
 -

==========================================================================================

RPL+: -------

<< 8 =r 0 =:s =:x =y [] =a DO r =a[++x] DO ++s x =y WHILE y 1 > REPEAT a[x] a[--y] - =:t IF 0 == t ABS x y - == OR THEN 0 =y WHILE a[x] -- =:a[x] 0 == REPEAT --x END END END UNTIL y 1 == END UNTIL x r == END s >>

==========================================================================================

JavaScript: [taken almost verbatim from C code] -------------------------------------

function() { /*as is*/ var r=8, s=0, x=0, a = []; do{ a[++x]=r; do{ ++s; var t, y=x; while(y>1) if (!(t=a[x]-a[--y]) || x-y==Math.abs(t)){ y=0; while(!--a[x]) --x; } } while(y!=1); } while(x!=r); return s; }

Edited: 21 June 2011, 7:54 a.m.

                  
Re: HP-41CL Calculator Benchmark
Message #7 Posted by Xerxes on 21 June 2011, 5:16 p.m.,
in response to message #6 by Oliver Unter Ecker

Hi Oliver,

thank you for this interesting comparison, but if I'm right the ND1 is an App and the speed depends on the used device. Please consider that the benchmark is especially for physical calculators and calculator like pocket computers of the past. I think comparing software or emulated calculators needs an own benchmark list with tests on different hardware. Thank you for your understanding.

                        
Re: HP-41CL Calculator Benchmark
Message #8 Posted by Oliver Unter Ecker on 21 June 2011, 5:46 p.m.,
in response to message #7 by Xerxes

Hi Xerxes,

Yes, ND1 is an app. I understand what you're saying and did notice that almost all results were for HW calcs. I saw a C64 result in there, which encouraged me to suggest this addition anyway.

But that's ok, I understand.

(I'll reapply after I figure out how to get a JavaScript VM running on an HP-30b. Ok, that's a joke. I think.)

Cheers.

                              
Re: HP-41CL Calculator Benchmark
Message #9 Posted by Xerxes on 21 June 2011, 6:50 p.m.,
in response to message #8 by Oliver Unter Ecker

:)

The C64 stands for the missing Panasonic HHC with the Microsoft Basic ROM, because I suspect an equivalent speed. AFAIK there was also Snap Basic and Snap Forth available for the HHC.

      
Re: HP-41CL Calculator Benchmark
Message #10 Posted by exschr on 20 June 2011, 3:41 a.m.,
in response to message #1 by Juergen Keller

very nice contribution, Thank you both!

      
Re: HP-41CL Calculator Benchmark
Message #11 Posted by Paul Dale on 20 June 2011, 4:24 a.m.,
in response to message #1 by Juergen Keller

Since we're revisiting this benchmark. The WP 34S runs it in 2.3 seconds in real mode and 2.1 in integer.

The program is the same either way:

        001: LBL B
        002: CLREG
        003: 8
        004: STO 11
        005: RCL 11
        006: x=? 00
        007: SKIP 22
        008: INC 00
        009: STO ->00
        010: INC 10
        011: RCL 00
        012: STO 09
        013: DEC 09
        014: RCL 09
        015: x=0?
        016: BACK 11
        017: RCL ->00
        018: RCL- ->09
        019: x=0?
        020: SKIP 05
        021: ABS
        022: RCL 00
        023: RCL- 09
        024: x<>? Y
        025: BACK 12
        026: DSZ ->00
        027: BACK 17
        028: DSZ 00
        029: BACK 03
        030: RCL 10
        031: RTN

- Pauli

            
Re: HP-41CL Calculator Benchmark
Message #12 Posted by Xerxes on 20 June 2011, 2:06 p.m.,
in response to message #11 by Paul Dale

The fastest keystroke programmable! Thank you for testing.

            
Re: HP-41CL Calculator Benchmark
Message #13 Posted by Oliver Unter Ecker on 20 June 2011, 3:09 p.m.,
in response to message #11 by Paul Dale

10x faster than a HP-12C ARM in RPN and 40x (!) faster than a 50G in UserRPL? Wow!

I guess RPL's poor showing comes from this code being more about interpreting control structures, than computing.

                  
Re: HP-41CL Calculator Benchmark
Message #14 Posted by Marcus von Cube, Germany on 20 June 2011, 3:53 p.m.,
in response to message #13 by Oliver Unter Ecker

Quote:
10x faster than a HP-12C ARM in RPN
I was thinking that using SKIP and BACK would be responsible for the speed advantage of WP 34S over other designs but the 12C ARM is using the same hardware and direct addressing, no labels. Pauli must have done something right, I guess.

EDIT: Thinking twice, isn't the 12C ARM based on an emulation layer that mimics the old voyager processor and runs the original firmware almost untouched? This would explain why it's slower than a native implementation.

Edited: 20 June 2011, 4:07 p.m.

                        
Re: HP-41CL Calculator Benchmark
Message #15 Posted by Paul Dale on 20 June 2011, 5:54 p.m.,
in response to message #14 by Marcus von Cube, Germany

Quote:
I was thinking that using SKIP and BACK would be responsible for the speed advantage of WP 34S over other designs but the 12C ARM is using the same hardware and direct addressing, no labels.

I haven't tested but the long backward jumps might be faster using a GTO/LBL pair. I suspect that it is the distance of search that is important since both BACK/SKIP and GTO load every instruction from program memory. The LBL instruction executes very rapidly since it doesn't even call a worker routine.

If I could think of a better way to handle errors we'd get a fairly nice speed up. The current method saves the stack and volatile state before executing every instruction and restores it if an error occurred. This is quite expensive time wise but it allows a complete restoration with a minimum of code. The memory copy routine is optimised for space not speed which will also hurt a bit here.

Likewise, I've got lots of checks for illegal op-codes in the instruction dispatch & execution paths. Take these out and we'd get a small speed up. However, I'm not going to since the chance of an error causing havoc would increase too much.

The 12c is emulating the old (NUT?) processor.

Quote:
Pauli must have done something right, I guess.

I hope I've done more than one thing right in the firmware :-) Minimising the instruction decode/execute overhead was deemed desirable from the start.

- Pauli

                  
Re: HP-41CL Calculator Benchmark
Message #16 Posted by Oliver Unter Ecker on 21 June 2011, 6:45 a.m.,
in response to message #13 by Oliver Unter Ecker

I've collected a few benchmarks by now, and compared UserRPL speed to JavaScript. With this benchmark, the speed difference is 800x, when it normally is ~20x.

The ratio from ND1 to 50g is ~20x for UserRPL, and ~30x for RPL+ vs. UserRPL, in line with usual results.

I conclude that this benchmark, so far, is an outlier / worst case for UserRPL.

An internal build runs the RPL+ code in 0.008 seconds (that is, a whopping 300x faster than current ND1, and ~10,000x faster than HP-50g), employing code-morphing to JavaScript. I don't have implemented this yet fully, but this nice result provides some motivation to push ahead with this work.

So, thank you for this worst-case-for-RPL benchmark... ;-)

            
34s - I am IMPRESSED ... Re: HP-41CL Calculator Benchmark
Message #17 Posted by gene wright on 21 June 2011, 4:31 p.m.,
in response to message #11 by Paul Dale

I must admit yet again. 2.1 seconds. Wow.

                  
Re: 34s - I am IMPRESSED ... Re: HP-41CL Calculator Benchmark
Message #18 Posted by Paul Dale on 21 June 2011, 5:48 p.m.,
in response to message #17 by gene wright

It could be faster if we had the code space :-)

- Pauli


[ Return to Index | Top of Index ]

Go back to the main exhibit hall