[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
 fred_76 Junior Member Posts: 33 Joined: Feb 2019
RE: [HP35s] Fastest way to increment a variable
(04-29-2019 06:51 PM)Csaba Tizedes Wrote:  Two notes:
1.) How you measured?

Csaba,

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

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

Code:
 0 Σ+
Time : 63 ms (1.7x slower)

Code:
 CLSTK Σ+
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.

Code:
 1 Σ+
Time : 69 ms (1.9 slower)
 « Next Oldest | Next Newest »

 Messages In This Thread [HP35s] Fastest way to increment a variable - fred_76 - 04-29-2019, 03:13 PM RE: [HP35s] Fastest way to increment a variable - Albert Chan - 04-29-2019, 06:18 PM RE: [HP35s] Fastest way to increment a variable - ijabbott - 04-30-2019, 07:56 AM RE: [HP35s] Fastest way to increment a variable - fred_76 - 04-30-2019, 01:26 PM RE: [HP35s] Fastest way to increment a variable - Csaba Tizedes - 04-29-2019, 06:51 PM RE: [HP35s] Fastest way to increment a variable - grsbanks - 04-30-2019, 07:23 AM RE: [HP35s] Fastest way to increment a variable - Csaba Tizedes - 04-30-2019, 08:28 AM RE: [HP35s] Fastest way to increment a variable - fred_76 - 04-30-2019 01:18 PM RE: [HP35s] Fastest way to increment a variable - burkhard - 04-30-2019, 01:49 PM

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