The Museum of HP Calculators

HP Forum Archive 05

 Asking for help about infinite-loop program to benchmark an HP48G+Message #1 Posted by Andrés C. Rodríguez (Argentina) on 5 Apr 2001, 10:50 a.m. I just bought a HP 48G+ just for collecting purposes. It looks almost new, but I am puzzled about the speed of this unit, most functions take more time than I expected (based on my HP41 and 42 experience). Perhaps it is right this way, I don’t know. I would like to run a simple benchmark to see if this particular unit is OK or not. On a HP 41, I’d write a simple program (infinite loop) just as: LBL 00 1 + GTO 00 and see how many iterations took place during, say, one minute. (In fact, on a HP 41 I would use automatic duplication of the T stack register, or use a ISG loop, but I am trying to keep this example very simple and clear) I’ve found (as expected) that none of my programming experience in HP25, HP41, HP42 or HP32Sii is of any help. While I am prepared to work through the manuals to learn the HP 48 programming model, I would appreciate any shortcut right now! :-) Could someone please let me know how to create and run a infinite loop program on a HP 48? If someone knows, what speed (iterations per minute) should I expect? Thank you in advance Andres

 Re: Asking for help about infinite-loop program to benchmark an HP48G+Message #2 Posted by Ernie Malaga on 5 Apr 2001, 3:22 p.m.,in response to message #1 by Andrés C. Rodríguez (Argentina) Try the following for infinite loops: WHILE 0 0 SAME REPEAT /* Body of loop here */ END Essentially, what's happening is that the loop will repeat for as long as 0 and 0 are the same (i.e., always). You can use DO...UNTIL instead: DO /* Body of loop here */ UNTIL 1 2 SAME END which will repeat the loop until 1=2 (i.e., will never stop). -EM

 Re: Asking for help about infinite-loop program to benchmark an HP48G+Message #3 Posted by Joe Panico on 5 Apr 2001, 3:29 p.m.,in response to message #1 by Andrés C. Rodríguez (Argentina) Andres, A good source for HP48 programs is www.hpcalc.org. Using a loop yields different results depending upon the manner a value is incremented. A basic "infinite" loop is: DO UNTIL 0 END This doesn't count a value. You could add something after the DO before the UNTIL such as: 'A' INCR DROP assuming the variable A exists or try a stack solution: 0 DO 1 + UNTIL 0 END Joe

 Thank you !!Message #4 Posted by Andrés C. Rodríguez (Argentina) on 5 Apr 2001, 4:17 p.m.,in response to message #1 by Andrés C. Rodríguez (Argentina) Thank you Ernie and Joe!

 Just in case: Benchmark results (infinite loop)Message #5 Posted by Andrés C. Rodríguez (Argentina) on 6 Apr 2001, 9:17 a.m.,in response to message #1 by Andrés C. Rodríguez (Argentina) The simplest loop program (just add 1 to the x register and loop back) was run for 1 minute. The results are the number of iterations made by each model (approx): HP 41 C: 450 HP 42 S: 1750 HP 32 Sii: 3250 HP 48 G+: 11800 I don't have the exact numbers, I am posting this here just as an order of magnitude reference.

 Even fasterMessage #6 Posted by Joe Panico on 6 Apr 2001, 2:25 p.m.,in response to message #5 by Andrés C. Rodríguez (Argentina) Andres, Just for fun I tried the same loops in System RPL. This one did about 30,000 in one minute: ``` System RPL code %0 real number 0 BEGIN begin loop %1+ add real number 1 to item on stack ATTN? check if ON key is pressed UNTIL end of loop structure``` While this did about 50,000: ```ZERO binary integer zero BEGIN #1+ add binary integer 1 to item on stack ATTN? UNTIL``` I'm sure someone knowing assembly can acheive even greater performance. Joe

 Re: The 48 is fast compare to older calculators but...Message #7 Posted by Chan Tran on 6 Apr 2001, 5:17 p.m.,in response to message #5 by Andrés C. Rodríguez (Argentina) As you found out that the 48 would run programs much faster than the 41 or 42. However, you did mentioned that it seemed slow for most functions. I think the 48 is slower in manual calculation because it often has to do its garbage cleaning on its very large stack.

Go back to the main exhibit hall