[HP35s] Fastest way to increment a variable
|
04-29-2019, 03:13 PM
(This post was last modified: 05-06-2019 08:56 AM by fred_76.)
Post: #1
|
|||
|
|||
[HP35s] Fastest way to increment a variable
Hello
There are several ways to increment an integer variable by 1. But some are faster than others. First of all, the "most common one", which is the base time : Code:
With the slow equations : Code:
The ugly one : Code:
After an idea of Csaba, the counter is stored in the stat pile (to be recalled by the function [SUMS][n]) : Code:
Note that the CLSTK is required for time effectiveness as Σ+ runs faster when the registers x=y=0. If you want to be more friendly with the pile, use CLx instead of CLSTK, you will loose about 2 ms but it will be better for the pile's health ! If you don't use CLSTK or CLx, the execution time of Σ+ with x,y<>0,0 will take about 42 ms. The official alternative : Code:
The unexpected but quite fast one : Code:
If you agree to store constants in variables (here 1 in N), then : Code:
These are some ways to optimize the execution time on slow machines, like the HP35s, especially if those instructions are repeated hundreds of times. As a conclusion : RCL N | STO+V = 14 ms RCL V | NOT | +/- | STO V = 22 ms ISG V | Dummy line = 31 ms CLSTK | Σ+ = 37 ms 1 | STO+V = 37 ms CLx | Σ+ = 39 ms Σ+ = 42 ms RCL V | 1 | + | STO V = 49 ms EQN 1+V►V = 125 ms Fred |
|||
« 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)