Post Reply 
[HP35s] Fastest way to increment a variable
04-30-2019, 01:18 PM (This post was last modified: 04-30-2019 03:27 PM by fred_76.)
Post: #7
RE: [HP35s] Fastest way to increment a variable
(04-29-2019 06:51 PM)Csaba Tizedes Wrote:  Two notes:
1.) How you measured?


As the HP35s does not have a timer, I had to measure manually with this code :


Z001 LBL Z
Z002 500               *** number of loops, 500 gives a reasonable time ranging from 22 s to about 2 minutes for the slowest functions
Z003 STO I
Z004 123456          *** number entered in accordance to the function to test
Z005 STO X
Z006 654321          *** number entered in accordance to the function to test
Z007 STO Y
Z008 RCL X            *** loop to be repeated 500 times
Z009 RCL Y
Z010 ........            *** I enter here the function to test
Z011 DSE I
Z012 GTO Z008
Z013 RTN

I first measured the time for the empty loop, 10 times and I retain the median time = T0 (=21.80 s)

I then measure the time for the tested function, 5 times, retaining the median time = Tf

The execution time for the tested function is then :

Tef = (Tf-T0)/500*1000 in ms

For example :
function = x²
- Tf = 27.07 s >> Tef = (27.07-21.80)/500*1000=10.54 ms

(04-29-2019 06:51 PM)Csaba Tizedes Wrote:  Two notes:
2a.) Please test 0 SUM+ (this increases stat variable n) OR
2b.) 1 SUM+ (this increases stat variable n AND SUMx)

--- edited ----

[SUM+] is [Σ+] on the HP35S and take 42.1 ms to execute. This is far more than [STO+ var] with 9.1 ms. To recall the number of samples from the stat pile, we have to call the function [n] which takes 4.8 ms to execute, a bit faster than [RCL var] with 5.1 ms.

I tested


Time : 63 ms (1.7x slower)


Time : 37 ms (as fast as the base case)
Note that Σ+ runs faster when x = 0 (34 ms) and even faster when also y=0 (30 ms) so the CLSTK.


Time : 69 ms (1.9 slower)
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: [HP35s] Fastest way to increment a variable - fred_76 - 04-30-2019 01:18 PM

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