![]() |
Initializing Values in a Program (HP35s) - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: Initializing Values in a Program (HP35s) (/thread-125700.html) |
Initializing Values in a Program (HP35s) - Chuck - 10-03-2007 Suppose you need to initialize X=2 and Y=3 in a program. One method is:
001 2 A second method is to use EQN before each line
001 2 -> X where -> is the STO command. The second method obviously reduces the number of lines of code, but is one method any more efficient (timewise) over the other? I haven't been able to discern a difference in my small programs, so it's just really a matter of curiousity.
CHUCK
Re: Initializing Values in a Program (HP35s) - Egan Ford - 10-03-2007 Create a loop and time it:
E.g.: A001 100This will run your code 100 times. Use a stopwatch to time it. Edited: 3 Oct 2007, 1:03 p.m.
Re: Initializing Values in a Program (HP35s) - Arne Halvorsen (Norway) - 10-03-2007 Y001 LBL Y Used 1m 8s
Y001 LBL Y
Used 1m 57s Edited: 3 Oct 2007, 1:22 p.m.
Re: Initializing Values in a Program (HP35s) - Chuck - 10-03-2007 Okay, I looped it 100 times.
11 seconds with 2 and 20 seconds with
2 -> x
Looks like there is definitely a trade-off with speed -vs- size.
Re: Initializing Values in a Program (HP35s) - Meenzer - 10-03-2007 The difference in length is only
LBL A
Edited: 3 Oct 2007, 2:43 p.m.
Re: Initializing Values in a Program (HP35s) - Arne Halvorsen (Norway) - 10-03-2007 Equation are parsed run time every time used, so clearly there will by an overhead.
Re: Initializing Values in a Program (HP35s) - Paul Dale - 10-03-2007 I've not checked if this is the case here or not but don't trust the reported program lengths, they are wrong. To measure sizes more accurately, try looking at the change in the bytes free in the memory menu.
- Pauli
|