HP Prime vs HP71 benchmark

01202017, 08:35 PM
Post: #1




HP Prime vs HP71 benchmark
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. 

01202017, 10:35 PM
Post: #2




RE: HP Prime vs HP71 benchmark  
01202017, 10:57 PM
(This post was last modified: 01202017 10:59 PM by KeithB.)
Post: #3




RE: HP Prime vs HP71 benchmark
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. 

01232017, 05:38 PM
Post: #4




RE: HP Prime vs HP71 benchmark
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(). 

01242017, 08:00 AM
Post: #5




RE: HP Prime vs HP71 benchmark
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:= TICKSS; PRINT("T:"+T+" PI:"+4*(TH)/T+" E:"+E); END; END; Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP. 

01242017, 03:45 PM
(This post was last modified: 01242017 03:47 PM by KeithB.)
Post: #6




RE: HP Prime vs HP71 benchmark
Clever! I like the IP() trick!
Note that the Prime was faster than a naïve comparison of clocks would suggest. 

01242017, 04:32 PM
(This post was last modified: 01242017 04:34 PM by KeithB.)
Post: #7




RE: HP Prime vs HP71 benchmark
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. 

01242017, 05:48 PM
Post: #8




RE: HP Prime vs HP71 benchmark
(01242017 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 Tom L Cui bono? 

01242017, 06:13 PM
Post: #9




RE: HP Prime vs HP71 benchmark
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. 

01242017, 08:08 PM
Post: #10




RE: HP Prime vs HP71 benchmark
(01242017 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 Tom L Cui bono? 

01252017, 06:25 AM
Post: #11




RE: HP Prime vs HP71 benchmark
Hello,
Yes, both form do work.... Remember, you can also do a step and a downto in a for... Cyrille Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP. 

01252017, 06:26 AM
Post: #12




RE: HP Prime vs HP71 benchmark
How does the WP 34S cope with this problem???
Pauli 

01252017, 03:38 PM
Post: #13




RE: HP Prime vs HP71 benchmark
What problem?


« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)