Post Reply 
Summation based benchmark for calculators
12-26-2017, 09:11 AM
Post: #41
RE: Summation based test for calculators
We could add a new player in the list : numworks
for n=10000, 16s with the sum function, 8s with a python script.
for n=100000, the sum function doesn't work anymore, we have to do the job with a python script. The script takes 84s.
Find all posts by this user
Quote this message in a reply
12-26-2017, 10:36 AM
Post: #42
RE: Summation based test for calculators
(12-26-2017 03:45 AM)BobVA Wrote:  .

(12-26-2017 05:43 AM)mfleming Wrote:  .

(12-26-2017 09:11 AM)wawa Wrote:  .

Thanks!

Observations. Woah the 41CL is like a ti89! Not bad at all! Impressive.
And also numworks is pretty fast, although I was thinking it was faster than the prime for those "simple" tasks. Instead the prime is just a monster. (until the next generation of calculators)

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
12-26-2017, 11:40 AM
Post: #43
RE: Summation based test for calculators
Has anyone tried doing this in SysRPL on the 50g?
Find all posts by this user
Quote this message in a reply
12-26-2017, 01:45 PM
Post: #44
RE: Summation based test for calculators
(12-26-2017 11:40 AM)grsbanks Wrote:  Has anyone tried doing this in SysRPL on the 50g?

Not that I know.

As wrote, though. SysRPL, hpgcc, ASM on the 50g. ASM on several platforms. Lua on the nspire are possible ways to optimize the speed of the execution of this particular test but they cannot be really used during common usage of the calculator. The best reference for me is something that can be quickly assembled on the calculator itself.
Of course I would be interested as well by those optimizations. I strongly believe that lua on the nspire would close in to the prime and give the dust to numworks.

Further note. SysRPL may end up using already optimized functions so may not be that faster than userRPL. Maybe only the loop may be faster. Or could be that the absence of error checks may speed up everything greatly. I don't really know (therefore I ask the sysRPL experts to give it a shoot. Maybe DavidM, gerald H, 3298, Joe Horn and others).

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
12-26-2017, 02:39 PM (This post was last modified: 12-26-2017 03:16 PM by grsbanks.)
Post: #45
RE: Summation based test for calculators
Although I'm no SysRPL expert I;ve just given this a shot myself. I'm surprised to note that the speed increase is only about 10%.

If anyone wants to pick holes in it and optimize it further, this is the SysRPL code I used. Note that this is the "loop and add" approach rather than the built-in summation function. I can't see any point in converting the latter to SysRPL.

Code:
::
  CK1NOLASTWD
  CK&DISPATCH1
  BINT1 ::
    %IP>#
    %0
    SWAP
    CLKTICKS
    %3 %1/
    { NULLLAM NULLLAM }
    BIND
      #1+_ONE_DO
        INDEX@
        UNCOERCE
        %ATAN
        %SIN
        %EXP
        1GETLAM %^
        %+
      LOOP
      CLKTICKS
      2GETLAM
      bit-
      HXS>%
      % 8192
      %/
    ABND
  ;
;
Find all posts by this user
Quote this message in a reply
12-26-2017, 02:48 PM (This post was last modified: 12-26-2017 02:50 PM by pier4r.)
Post: #46
RE: Summation based test for calculators
(12-26-2017 02:39 PM)grsbanks Wrote:  Although I'm no SysRPL expert I;ve just given this a shot myself. I'm surprised to note that the speed increase is only about 10%.


Code:


      %ATAN
      %SIN
      %EXP
      %3 %1/ %^
      %+

10% means? (in seconds)

Anyway I think the quoted part of the code is where most of the time is spent. And those are firmware based functions, so hard to speed up. (unless one moves on ARM optimized functions)

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
12-26-2017, 03:26 PM
Post: #47
RE: Summation based test for calculators
(12-26-2017 02:48 PM)pier4r Wrote:  10% means? (in seconds)

Timings in seconds for 100 / 1000 / 10000 iterations on the HP 50g:

Using the 'Σ' function: 2.7 / 25.6 / 242.8
Using a SysRPL program: 2.81 / 26.57 / 260.41
Using a UserRPL program: 3.38 / 33.27 / 309.74

(12-26-2017 02:48 PM)pier4r Wrote:  Anyway I think the quoted part of the code is where most of the time is spent. And those are firmware based functions, so hard to speed up. (unless one moves on ARM optimized functions)

Very likely. In fact I rewrote the SysRPL program to remove the repeated calculation of 1/3 and have updated the code in my previous post to reflect this. As a result, the gap between UserRPL and SysRPL has been widened to 15-20% depending on which figures you look at.

For reference, this is the UserRPL program I was using:

Code:
\<< ABS IP \-> n
  \<< TICKS 0. 1. n
     FOR n n ATAN SIN EXP 3. INV ^ +
     NEXT TICKS ROT - B\->R 8192. /
  \>>
\>>
Find all posts by this user
Quote this message in a reply
12-26-2017, 04:06 PM
Post: #48
RE: Summation based test for calculators
Very odd. I keyed in a solution in RPN on my new DM-42 (S/N 217) and locked the machine up. Ooops. Had to do a hard reset and deleted everything.

I will try it again and see what happens. It had run the 42S manual TVM solver program fine yesterday.

I will post the program I used (inefficiencies and all) if it locks me up again.
Find all posts by this user
Quote this message in a reply
12-26-2017, 05:55 PM
Post: #49
RE: Summation based test for calculators
ok, locked again. :-( The program below was entered on a MEMORY LOST DM-42. Please be gentle if I did something really really stupid here.

DM-42 S/N 217. Opened yesterday!

Program:

Code:
LBL AA
CLX
STO 00
1000
STO 01
LBL 00
RCL 01
ATAN
SIN
E^X
3
1/X
Y^X
STO+00
DSE 01
GTO 00
RCL 01
END

When it crashed, display was showing this:
L: 478
Y, Z and T showing 1.3956
X showing 89.8801
Find all posts by this user
Quote this message in a reply
12-26-2017, 06:22 PM
Post: #50
RE: Summation based test for calculators
(12-26-2017 05:55 PM)Gene Wrote:  ok, locked again. :-( The program below was entered on a MEMORY LOST DM-42. Please be gentle if I did something really really stupid here.

DM-42 S/N 217. Opened yesterday!

Gene,

There is a thread over at SwissMicros for this exact issue:

Bug Report - Hang Detection

Michael and David are more likely to see your input in their forums.

FWIW, I tried unsuccessfully to reproduce this crash over the span of an hour.

Warmest holiday greetings,

Mark Hardman

Ceci n'est pas une signature.
Find all posts by this user
Quote this message in a reply
12-26-2017, 07:05 PM
Post: #51
RE: Summation based test for calculators
Thanks, Mark. Posted this over there.

I am VERY impressed with the DM-42. This crash is concerning :-( but the only other item of ANY kind is that the square root symbol on the key is markedly to the left of centered. It's pretty obvious that it is off-center. Love my little machine. Time to get .raw files of any and all HP 41 programs in a file area so they can be loaded...especially BIG long game files.

Well, games and math functions not built into the DM-42. Think statistical distributions and a lot of the material in Sandmath for the 41.
Find all posts by this user
Quote this message in a reply
12-26-2017, 07:18 PM
Post: #52
RE: Summation based test for calculators
Ok this loop hangs too. Keyed 1000 then R/S at LBL 00. Posted to the DM-42 forum as well.

Code:
LBL 00
STO 00
CLST
STO 01
LBL 01
RCL 00
LN
E^X
LOG
10^X
SQRT
X^2
STO+01
RCL 00
RCL 01
DSE 00
GTO 01

When it hangs, display shows Z and T showing 583. Y shows 330,847 and X shows 582. L shows 2.7649.

Interestingly, rearranging the code this way does **not** hang. Same 1000 R/S inputs. The only differences are doing the powers before roots, the antilogs before logs.

Odd!

Code:
LBL 00
STO 00
CLST
STO 01
LBL 01
RCL 00
E^X
LN
10^X
LOG
X^2
SQRT
STO+01
RCL 00
RCL 01
DSE 00
GTO 01
Find all posts by this user
Quote this message in a reply
12-26-2017, 07:42 PM
Post: #53
RE: Summation based test for calculators
(12-26-2017 07:18 PM)Gene Wrote:  Ok this loop hangs too. Keyed 1000 then R/S at LBL 00. Posted to the DM-42 forum as well.

FWIW, I do not think this is related to the code – it should run fine. According to the given stack contents one can say that the crash happened after executing the 10^x instruction when the loop counter in R00 was 582. For the previous example it's the ATAN instruction when R00 is 478. But all this should run without problems, so I think you should follow the thread on the Swiss Micros forum.

Dieter
Find all posts by this user
Quote this message in a reply
12-26-2017, 09:08 PM
Post: #54
RE: Summation based test for calculators
Yep, I agree. I am glad to have found so quickly another loop that crashes. Might help when you have more than one item that -> crashes the machine. :-)
Find all posts by this user
Quote this message in a reply
12-26-2017, 09:57 PM
Post: #55
RE: Summation based test for calculators
(12-26-2017 05:43 AM)mfleming Wrote:  
(12-26-2017 03:45 AM)BobVA Wrote:  HP-41CL / x50 speed: 100 iterations (139.2926) 15s

I get something different. 41CL, v5 board, TURBO 50. Using the Sigma+ function to accumulate intermediate values because it has the advantage of returning the index X each invocation. Twelve instructions from the loop header label to the bottom GTO with no instructions other than the 41C/CV/CX defaults:

Nice!

I used the ISG register increment and a STO+ register operation to accumulate the results. (I think it's the first HP-41 code I've written in about 15 years.
Nice diversion to leaf through the manual again, but I probably came up with the slowest imaginable implementation!)
Find all posts by this user
Quote this message in a reply
12-27-2017, 11:15 PM (This post was last modified: 12-27-2017 11:50 PM by Gene.)
Post: #56
RE: Summation based test for calculators
Ok, another set of hang tests.

LBL AA
STO 01
CLX
STO 00
LBL 00
RCL 01
LOG
10^X
STO+00
DSE 01
GTO 00
RCL 00
END

Hangs with 348 showing in the display in X. L contains 2.5416.

Interestingly, the LOG and 10^X steps if replaced with LN and e^X do not hang. Neither does a one step 1/x in the loop.

But LOG and 10^X hang.


NOTE: Runs fine on USB connection, but hangs while on battery.
Find all posts by this user
Quote this message in a reply
12-30-2017, 09:57 AM (This post was last modified: 12-30-2017 10:00 AM by pier4r.)
Post: #57
RE: Summation based test for calculators
little update

Still missing
- 12C (recent and old)
- 71B
- Some sharp PC
- other capable (programmable or with sum function) calculators

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
01-02-2018, 10:30 AM (This post was last modified: 01-02-2018 01:35 PM by pier4r.)
Post: #58
RE: Summation based test for calculators
Updated the second post after this: http://www.hpmuseum.org/forum/thread-982...l#pid87596

still missing
- 12C (recent and old)
- 71B
- Some sharp PC
- other capable (programmable or with sum function) calculators

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
01-02-2018, 10:57 AM
Post: #59
RE: Summation based test for calculators
(01-02-2018 10:30 AM)pier4r Wrote:  till missing
- 12C (recent and old)

This one will stay missing for quite a while because it lacks the trig functions that are required.

One way round it is to use the fact that \( sin(atan(x)) = { x \over \sqrt(1+x^2) } \) Smile

That, however, doesn't benchmark the trig functions, so any results obtained would not be relevant to this particular test.
Find all posts by this user
Quote this message in a reply
01-02-2018, 01:36 PM (This post was last modified: 01-02-2018 01:40 PM by pier4r.)
Post: #60
RE: Summation based test for calculators
(01-02-2018 10:57 AM)grsbanks Wrote:  [

This one will stay missing for quite a while because it lacks the trig functions that are required.

Oh. I know that the 12C was a business model but I thought that the basic trig/exp were there. My bad. Removing.

Thanks for the observation!

still missing
- 71B
- Some sharp PC
- other capable (programmable or with sum function) calculators

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
Post Reply 




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