HP Prime vs HP71 benchmark - Printable Version +- HP Forums ( https://www.hpmuseum.org/forum)+-- Forum: HP Calculators (and very old HP Computers) ( /forum-3.html)+--- Forum: HP Prime ( /forum-5.html)+--- Thread: HP Prime vs HP71 benchmark ( /thread-7634.html) |

HP Prime vs HP71 benchmark - KeithB - 01-20-2017 08:35 PM
I finished my random Pi program and compared the Prime and HP71. Here is the prime program: Code:
Basically you generate two random numbers and see if it is within the radius of a circle. The ratio of the number of points inside the circle and all the points is pi/4. For 50,000 pairs: HP71: Pi=3.14592; Time: 8370 seconds Prime: Pi=3.14592; Time 8.732 seconds The prime was 960 times faster than the HP71, which I guess is not really a surprise, given the clock ratio is about 640. (Unlike the HP71, I cannot get an exact clock speed for my prime - no peek() function). The calculations appear to be identical - even to the random numbers generated. RE: HP Prime vs HP71 benchmark - Erwin - 01-20-2017 10:35 PM
(01-20-2017 08:35 PM)KeithB Wrote: I finished my random Pi program and compared the Prime and HP71.Hi, very interesting ... would you show us the program of the HP71B? Could be interesting how fast the calc with the HP71B FORTH would be? regards Erwin RE: HP Prime vs HP71 benchmark - KeithB - 01-20-2017 10:57 PM
Here is the 71B program: Code:
I have a FORTH module, so if you have a FORTH word to run, I would be glad to try. ETA: I guess I could try assembler, too. RE: HP Prime vs HP71 benchmark - KeithB - 01-23-2017 05:38 PM
I just got the results using the CAS rand() function. For 50,000 pairs: Pi = 3.13752 Time = 59.752 seconds, or almost 7X slower than RANDOM(). RE: HP Prime vs HP71 benchmark - cyrille de brébisson - 01-24-2017 08:00 AM
Hello, The most surprising thing is that Prime is not much faster than the 71. Prime runs at 400Mhz, I do not know how fast the 71 runs.... However, the 71, being based on a Saturn CPU also has slow instructions (ie, the instructions can take up to 15 or 20 CPU cycles to execute). Most Prime CPU instructions only take 1 cycle.... However, the Prime programming language will be much less efficient than the 71 as the 71 interpreted does not need to do any type of memory allocation or things like that while the prime will have to do a LOT of them. BTW, you can optimize the Prime program as follow: It will run around 1.5 times faster I think... EXPORT PI2() BEGIN H:=0; T:=0; S:=Ticks; RANDSEED(1); WHILE 1 DO for A:= 1 to 10000 DO H:= H+IP(RANDOM()^2+RANDOM()^2); end; T:= T+10000; E:= TICKS-S; PRINT("T:"+T+" PI:"+4*(T-H)/T+" E:"+E); END; END; RE: HP Prime vs HP71 benchmark - KeithB - 01-24-2017 03:45 PM
Clever! I like the IP() trick! Note that the Prime was faster than a naïve comparison of clocks would suggest. RE: HP Prime vs HP71 benchmark - KeithB - 01-24-2017 04:32 PM
Thanks cyrille. But you have a bug*. H is supposed to be the number of hits *inside* the circle, not outside. I had to add an extra count and subtract that from 10000 to get things to work. Anyway, that does speed things up as you said, it now takes about 5.1 seconds for 50000 iterations. That makes the prime about 1650 times faster than the HP71. BTW, what is up with the 'C like' for loop? It works without a syntax error, but is not documented. Is any expression allowed in the place of the from? ETA: OOPS, I did not see that you had corrected the PI calculation to correct for this, sorry. RE: HP Prime vs HP71 benchmark - toml_12953 - 01-24-2017 05:48 PM
(01-24-2017 04:32 PM)KeithB Wrote: BTW, what is up with the 'C like' for loop? It works without a syntax error, but is not documented. Is any expression allowed in the place of the from? The for statement is documented which statement are you referring to? Tom L RE: HP Prime vs HP71 benchmark - KeithB - 01-24-2017 06:13 PM
The fact that he uses: FOR A:=1 TO 10000 DO Instead of FOR A FROM 1 TO 10000 DO Leaving out the FROM is not documented. RE: HP Prime vs HP71 benchmark - toml_12953 - 01-24-2017 08:08 PM
(01-24-2017 06:13 PM)KeithB Wrote: The fact that he uses: Ha! You're right! I come from a BASIC background so I never even thought of putting FROM in there. I've always used the undocumented version. Maybe I should read the manual more often! Tom L RE: HP Prime vs HP71 benchmark - cyrille de brébisson - 01-25-2017 06:25 AM
Hello, Yes, both form do work.... Remember, you can also do a step and a downto in a for... Cyrille RE: HP Prime vs HP71 benchmark - Paul Dale - 01-25-2017 06:26 AM
How does the WP 34S cope with this problem??? Pauli RE: HP Prime vs HP71 benchmark - KeithB - 01-25-2017 03:38 PM
What problem? |