The Turtle (HP-71B) and the Hare (HP49G+) [LONG]



#13

Hi all,

For some time now, I've been reading in this forum, the comp.sys.hp48 newsgroup and several other such places lots and lots of posts about the new HP49G+, both pointing out its deficiencies and its virtues.

Among the later, the one most frequently mentioned is its "amazing speed", or that it is "incredibly fast", and many other such praises. However, some actual running times posted here and there I find somewhat contradictory, specially when confronting posted speeds with that of the most venerable Saturn CPU holder of all, the HP-71B itself.

Now, what amazes me is this: first of all, I do not own an HP49G+ (nor any other HP48/49 models for that matter) and thus I may be wrong on this, but I believe that both the oldest HP-71B and the newest HP49G+ boast Saturn CPUs, (physical in one case, emulated in the other), and so ...

  • The HP-71B's Saturn CPU is the oldest version and runs
    at a meager 650 Khz, while the HP49G+ emulates the most modern Saturn version and allegedly the emulation runs appreciably faster than a real 4 Mhz Saturn CPU. This alone should mean that the HP49G+ should be faster than the HP-71B by a factor larger than 4/0.65 = 6.15 times.

  • Besides, there's also the fact that the HP49G+ uses RPL for its programming language, and RPL is supposedly much more efficient and thus faster than slow BASIC line-by-line interpretation, which presumably should also give it an additional speed boost when doing complex calculations or running non-trivial programs.

Considering both facts together, I fully expected the 49G+ to be between 6.15 times faster than the 71B at the very least, and probably more like 10 times faster. However, some recent timings posted here and there resulted in factors around 3x, far from the expected 6x-10x range, so I would like to settle down this matter for good, in order to ascertain the real speed of the 49G+ when compared to the 71B, and if it's indeed inferior to 6x, to ask for the reasons why this is so against expectations.

To that effect, I would like to ask that those of you who own a 49G+ and who are willing to do me this favour, please run the following test examples. Of course, discussing as we are such powerful machines, no willy-nilly "ASIN(ACOS(ATAN(SIN(COS(TAN(9))))))" test will do, nor some simple loops or computing some ancillary expression. We are after timings for powerful, complicated algorithms and that's what we shall try here. Bear with me:

  1. Matrix operations:

    Set up the test by creating a real-valued matrix A with the specified dimensions, and fill it up with different random values between 0 and 1.

    These are the HP-71B times in seconds for the following dimensions and operations. Times are given just for the operation, not for any set up or displaying results.

                       Matrix       True matrix       Matrix 
    inversion multiplication addition
    --------------------------------------------------------
    Dimensions MAT A=INV(A) MAT A=A*A MAT A=A+A
    --------------------------------------------------------
    10x10 7.5 7.3 0.4
    20x20 57 57 1.7
    30x30 185 188 3.7
    40x40 432 435 6.7
    Notice that all operations should be in place, i.e.: no additional
    matrix is required to hold the result. The matrix inversion, for
    instance, is done in the same space occupied by the original
    matrix being inverted, so no extra RAM is allocated for the result
    or intermediate operations. Also, the matrix multiplication is
    true matrix multiplication, not every element being replaced
    by its square, and should be done also in place, not allocating another matrix to hold the result. Same for the addition.


  2. Polynomial Solver


    Find all roots (both real and complex), of the 100th-degree equation:

         x^100 + x^99 + x^98 + ... + x^2 + x + 1 = 0
    These are the setup steps for the HP-71B:
         OPTION BASE 1            lower indexes will be 1
    COMPLEX R(100) dimensions the roots' vector (100 complex roots)
    DIM C(101) dimensions the coefficients' vector (101 coefficients)
    MAT C = (1) makes all coefficients equal to 1
    Now we compute all 100 complex roots at once and time the result:
         MAT R = PROOT(C)
    which in my HP-71B takes 1939 seconds. Half the computed roots are correct
    to 12 digits, the other half are correct within a few counts in the 12th place.
    You can quickly check the correctness of the computed roots by simply
    adding and/or multiplying all 100 roots together, the result should be 1
    in both cases. For instance, using the HP-71B, you can compute the product of all 100 complex roots
    by executing this multi-statement command from the command line:
          COMPLEX P @ P=1 @ FOR I = 1 TO 100 @ P = P * R(I) @ NEXT I @ DISP P
    which promptly returns (0.999999999944, 1.312E-12). The exact value is (1,0)


  3. Integrate & Solve combined


    Find the value of X in [1,2] such that the value of the integral of Sin(x^2).dx within limits 0 and X equals 1/2. We care to get about 5 correct decimal places for X:

                /X
    | 2
    | Sin(x ).dx = 1/2
    |
    /0
    For the HP-71B, we make sure RADIANS mode is set and then execute from the keyboard (and time) this command:

         FNROOT(1, 2, INTEGRAL(0, FVAR, 1E-5, SIN(IVAR * IVAR)) - 0.5)

    which gives X = 1.2039153, correct to all 8 digits shown, in just 42 seconds.


  4. Double integrals

    Compute the following double integrals:

                /2  /X
    | |
    I = | | (x + y).dy.dx
    | |
    /1 /1

    A doubly nested INTEGRAL keyword (with precision 1E-3), gives I = 1.50000 (correct to all 6 digits shown) in just under 17 seconds.

                /1  /1
    | | x^2*y^2
    I = | | e .dy.dx
    | |
    /0 /0
    Using the same 1E-3 precision, it gives I = 1.1351 (correct to all 5 digits shown) in 35 seconds.


  5. Triple integrals

    Computing the triple integral:

               /2  /X  /X*Y
    | | |
    I = | | | (x * y * z).dz.dy.dx
    | | |
    /0 /0 /0
    with a precision of 1E-3, gives I = 4.0000 (correct to the 5 digits shown) in 1242 seconds

That's all. Please run these tests as stated, making extra-sure that no symbolic features or 'algebraic-aware' simplifications are used (just numerical results), and post here the values obtained and the time. Of course this is no Aesop's fable and I know that the Hare will easily win this time, only I want to know by how much and why that much.

Thank you very much in advance, and

Best regards from V.


#14

Valentin,

Your challenging comparison test is of great interest to me and I plan to do it with both the 71B and the 49G+. Should I use the math module with the 71B or not for these comparisons? Since I have not used it for a long time I do not really remember which functions are native to the basic machine. As for the 49G+, I'm still on the learning curve and will use your challenge as an aid to better utilizing its capabilities. Thanks!


#15

Hi, Art:

Art posted:

"Should I use the math module with the 71B or not for these comparisons?"

Definitely. If you've been following my posts this last year, you're probably aware that I do not consider the 71B and its Math ROM as two separate, independent entities, but rather a 71B isn't "whole" for me unless it has its Math ROM plugged-in.

That may seem a little extreme on my part, but there are a number of very good reasons for me to consider it that way. So, everytime I say or write "HP-71B" it always includes the Math ROM just as if it was built-in in origin.

Anyway, you don't need to run these test on a 71B at all, that I already did. The results for the 49G+ are the ones I'm after. :-)


"As for the 49G+, I'm still on the learning curve and will use your challenge as an aid to better utilizing its capabilities."

Best of lucks, then. Be assured that the examples are
fairly trivial (for such powerful machines), and the
integrals in particular are of the simplest functions for the most part, no singularities or difficulties anywhere, smooth as a baby's cheek.

Thanks a lot for your interest and

Best regards from V.

#16

One of the reason the 49G+ is not so fats is that the CAS and exact arithmetics can't really be fully disabled if you use USR RPL: On some functions, the 49 spends more time checking the conditions under which it has to execute this function than actually executing this function.

I will however try to run these tests and keep you updated.

Arnaud

#17

Here are the results for the 49g+(49G)

Matrix operations: Note that the 48/49 keeps the arguments in memory so these are not done in place
2.26(4.89) 1.30(2.31) 0.24(0.58)
14.00(28.2) 9.49(17) 1.16(2.95)
42.70(82.3) 30.72(56.4) 2.71(7)
93.40(185) 70.52(132) 4.86(12.95)

Polynom roots:
It takes 302s(533) and after testing I get (0.999999994031,1.441E-12)

Integrate and Solve:
I get X=1.20391530969 after 19.39s(36.35) (5 decimal precision)

Double integrals:
I get I=1.49999542236 after 3.229s(7.36) (3 decimal precision)

I get I=1.13509856804 in 9.27s(19.22) (3 decimal precision)

I get I=3.9999873874 in 237s(550) (3 decimal precision)
[/pre]

Note that the 49G has a 4MHz saturn. It would be nice if someone did the same on a 4MHz 48GX. My 48 is dead now but I believe it would be faster than the 49 as it does not do as many checks.

I also want to note that nearly nowhere for the integration is RPL used, all is in algebric. And for the others I believe you compare ASM in the 71 math ROM with sysRPL for the 48/49. Maybe you should time a simple program to compare speed of execution of 71 BASIC with 49 USR RPL

I hope all of this helps and am looking forward to comments on these results.

Arnaud


Edited: 25 Feb 2004, 3:15 p.m.


#18

...if nobody post before...


#19

These are the results on a 48GX(plus 128kb and 1M RAM cards) running with MetaKernel. Time has been mesured with TEVAL (from Erable):

matrices (random values, but not between 0 and 1)

5.2     2.4    0.8
31.5 10.6 3.8
105.5 34.6 10.1
188.5 131.6 15

Polynom roots: It takes 563s and after testing I get (0.999999994032,2.066E-12)

Integrate and Solve: I get X=1.20391530969 after 36.5s (5 decimal precision)

Double integrals: I get I=1.49999542236 after 6s (3 decimal precision)

I get I=1.13509856804 in 17.5s (3 decimal precision)

I get I=3.9999873874 in 483s (3 decimal precision)

#20

Arnaud,
Can I ask what program you're using to get the timings for the operations?

I was going to use Joe Horn's timer but wanted to use the same thing you're using.

Doug


#21

I usually use TEVAL. However for long times it seems to be buggy so in that case I do something like << TIME 'Q' STO EVAL TIME Q HMS- 'Q' PURGE >>

However TEVAL is not available on a 48. There I used to use TIM from Mika H...(can't spell it correctly so I don't spell it at all).

Arnaud

#22

I have no experience with the 48 or 49, but have used my 71 a lot for things the more modern supercalculators were not made to do.

On many occasions I have downloaded a set of 8192 points from a Philips digital oscilloscope to do an FFT on them and print the results in graphs showing amplitude and phase. The 71 was connected to other pieces of equipment at the same time.

The 8K complex FFT took about 40 minutes; but what the heck-- I had to take lunch or put out another fire anyway. I have been extremely pleased with the design of the 71; but it might have been better to do the FFT with fewer digits. With the number of points you normally put in and the fact that they'll typically come from something like an 8-bit oscilloscope, there's no need for 12-digit calculations plus three internal guard digits. I'm sure they could have made it faster.

#23

Hi, Arnaud:

Thank you *very much* for your extensive results to my
tests, I'm already studying them carefully.

However, in order to draw valid conclusions and comment
on the results, I need another independent tester, apart
from yourself, to check and validate that both your result
sets do indeed agree (within some 10% tolerance, say).
Else I can't be really sure that your results are valid
and would be produced by any similar machine.

Of course, the more results set received, the better. But
two independent ones is a minimum.

As for your comment: "I believe
you compare ASM in the 71 math ROM with sysRPL for the 48/49. Maybe you should time a simple program to
compare speed of execution of 71 BASIC with 49 USR RPL"

I am only using what the 71B's got. In the case of integration, most of the time is spent in the user-defined
function, which is pure BASIC, not ASM. Same for root
solving. Only the matrix operations are mostly ASM.

If the 48/49/49G+ makes use of System RPL or User RPL, I can't tell. Logic dictates that it should use ASM routines as well for speed and convenience, right ? I believed that most mathematical algorithms were ported straight from the 71B Math ROM version, which is written for the same Saturn CPU they have, with minor changes for memory and exception
handling and such. It would seem to save lots of design
time and would make financial sense.

Also, if you suggest that I use instead a BASIC loop versus User RPL, presumably in order not to handicap User RPL, why should I do so ? I could use FORTH instead if ASM is the problem here, but why use the slowest possibility if the machine can do it in ASM ? Can't the 48/49/49G+ use it as well ? I'd be surprised it that's indeed the case.

Besides, the HP-71B is a machine specifically designed and
intended for efficient, fast math computation. Its very CPU is optimized for that, its intruction set, operating system and hardware fine-tuned for that. It is no good at all running FOR-NEXT loops, or executing GOTO/GOSUB branches, as many tests duly confirmed when it was introduced. But when running long, complicated math programs, it excelled and surpassed many otherwise faster PCs of the time.

That's its main strength and that's what I want to test against. BASIC loops or 'simple' BASIC programs mean not
a thing to me in my use of the 71B.

Thanks again and best regards from V.

Edited: 26 Feb 2004, 6:10 a.m.


#24

I agree with all your points but because I don't know the 71 at all I can't say.
What really want to make clear is that the 48/49 have nearly 30 different objects and for each RPL operations the arguments are checked to decide what to do with them. This creates quite some overhead as I hope will be shown when comparing 48 with 49G results (the 49 has even more objects and checking). I would think the 71 does not have this overhead.
If you look inside of the 49 ROM, you will eventually get to some ASM routines but a lot of sysRPL checking and conditioning of the arguments take place before you get there. I would think this would be reduced in the 71 Math ROM.
As a whole I would think that the main reason why you don't get 6.5 times speed increase would be: argument checking and garbage collection. As I said the 48/49 rarely do in place operations and many loops create lots of garbage. For garbage collection, the 49 should be better than the 48 as its algorithm, I believe has been improved, but it also has more RAM so more collection to do. The 49g+ handled garbage collection directly using the 75MHz ARM so it will be at an advantage here.

I am looking forward to the 48 results that should illustrate a bit of what I am saying here. I don't know much about the hp28 but I believe it is 2MHz Saturn and uses RPL but with less objects than the 48, maybe results for the 28 would be interesting as well.

I'll keep watching this thread. I believe that when you have written your conclusions they should be archived in the articles part of this forum.

Arnaud

#25

These are the HP-49G+ times in seconds for the following dimensions and operations.

1. Matrix Operations
Matrix True matrix Matrix
inversion multiplication addition
--------------------------------------------------------
Dimensions MAT A=INV(A) MAT A=A*A MAT A=A+A
--------------------------------------------------------
10x10 2.2326 1.2709 .2433
20x20 14.0164 9.4485 1.1564
30x30 41.6209 30.5054 2.7413
40x40 93.1081 70.2594 4.9569

2. Polynomial Solver
Time: 301.7302 Answer: (.99999999403, 1.4410E-12)

3. Integrate & Solve
Time: 19.40140 Answer: 1.2039153097 (5 digit precision)

4. Double Integrals
a) Time: 3.2004 Answer: 1.4999954224 (3 digit precision)
b) Time: 9.2567 Answer: 1.1350985680 (3 digit precision)

5. Triple Integrals
Time: 237.7347 Answer: 3.9999873874 (3 digit precision)

-------------------------------------------------------------------

My numbers coincide with Arnaud's numbers very closely. Let me know if you need any other calculations done. I also have a 49G, 48GX, 42S, 32SII, 33S, and a 28S.

Doug

Edited: 27 Feb 2004, 1:01 a.m. after one or more responses were posted


#26

I think it would be good to see.

Gene

#27

I couldn't resist ...

As you compare the venerable HP-71B with a modern emulator-based machine, I think it's fair to also compare the last one to my Emu71 HP-71B emulator:

1. 40x40 matrix multiply: 8s

2. 100th-degree equation solver: 31s

3. Integrate & Solve combined: 0.3s

4. Double integrals: 1.5s

5. Triple integrals: 18s

Of course, I got the same numerical results.

All tests done on a 2.3GHz Celeron in a Windows2000 Comand Box in full screen mode, and with Emu71 fast option ('Emu71 /f' command).

J-F


#28

Ah, you've opened the gates to PC-Based emulation here...

so let me add a couple of data points:- this time using V41 R8 in turbo mode, alas comparing an emulated coconut (with Advantage) to all of the above!

Example 1.- 23x23 Matrix ops (sorry, no larger is possible)
----------------------------
Inversion : 4,66 seconds


Example 3:- SOLVE and INTEG combined.
-------------------------------------
"VA2" in Alpha
1 ENTER^ 2 INTEG

returns the correct value in 7.56 seconds. Interesting, isn't it?

and here's the program listing:

LBL "VA2"
0
X<>Y
"VA"
INTEG
0.5
-
RTN
LBL "VA"
X^2
SIN
END

I will, of course, pass on the opportunity to calculate the 100 roots of V's monster polynomial... even though I've written a program that CAN do it, for any degree, it still takes about 2-4 seconds per root (which it isn't bad at all if you think about it)


For what's worth ...

Best, ÁM

#29

I measured these times on my HP-71X emulator running on HP-49G. Here are the results:

1. Matrix Operations:

Matrix True matrix Matrix
inversion multiplication addition
--------------------------------------------------------
Dimensions MAT A=INV(A) MAT A=A*A MAT A=A+A
--------------------------------------------------------
10x10 2.48 2.37 0.15
20x20 18.02 18.38 0.58
30x30 58.93 61.69 1.27
40x40 136.81 145.53 2.25

2. Polynomial Solver: 597.76 seconds

3. Integrate & Solve combined:

X=1.20391532663 in 12.81 seconds (with precision 1E-5)

4. Double Integrals:

(1) I=1.49999542236 in 3.44 seconds (with precision 1E-3)
(2) I=1.13509856804 in 7.39 seconds (with precision 1E-3)

5. Triple Integral:

I=3.9999873874 in 252.76 seconds (with precision 1E-3)

The times on HP-48GX are the same (+/- 0.1 seconds). This is from 3 to 5 times faster compared to the real HP-71B and, more or less, show how would HP-71B run if it would be built using HP-48/49 hardware. HP-71X has been used in 33.5K RAM configuration with ports 1..3 CLAIMed and port 4 containing the MATH ROM.


#30

Could you kindly compile ALL the timings presented in this forum in one post, please?!

AND also include hp 49g+/HP-71X results along with your HP 49G/HP-71X results.

I will print the table in A4 and hang it above my screen

Thank you! [VPN]


#31

There are no HP-49G+/HP-71X results because I haven't tested HP-71X on HP-49G+ and I don't believe it will work on 49G+ because many things regarding port management, timer etc. have been changed and are incompatible with HP-48GX/49G. I don't have any plans to support it in my emulators for now ...


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP Prime: Long integers (continued) Helge Gabert 2 684 11-07-2013, 11:24 AM
Last Post: Helge Gabert
  HP Prime: Pass "Long" Integers to a Program Helge Gabert 6 1,139 11-03-2013, 01:12 PM
Last Post: Helge Gabert
  HP Prime polynomial long division bluesun08 13 1,700 10-30-2013, 03:29 AM
Last Post: parisse
  A very long HP-17BII equation Gerson W. Barbosa 22 2,721 04-19-2013, 12:37 AM
Last Post: Gerson W. Barbosa
  A long WP-34S night Siegfried (Austria) 10 1,455 04-16-2013, 02:11 AM
Last Post: Siegfried (Austria)
  HP-25 left on for a long, long, while Matt Agajanian 12 1,520 04-10-2013, 11:33 PM
Last Post: Steve Leibson
  RPL long vs. short names peacecalc 5 936 10-30-2012, 01:25 PM
Last Post: peacecalc
  HP41 Long term storage Steve Hunt 6 899 09-27-2012, 11:08 PM
Last Post: db (martinez, ca.)
  Long term storage question on 15C LE nick lidakis 4 767 09-12-2011, 01:35 AM
Last Post: Peter Murphy (Livermore)
  Too Long With No New Calculators! Jeff 12 1,365 05-13-2011, 10:28 AM
Last Post: Marcus von Cube, Germany

Forum Jump: