[comp.sys.handhelds] HP28 internals

pedz@bigben.mpd.tandem.com (Perry Smith) (08/01/90)

I have started using my HP28 as an electronic checkbook and it has all
my checks and deposits in there so I can search through it etc.  The
problem is that I have a program which takes about 45 seconds when I
give it a list of 100 or so items but it takes days and days when I
give it a list of 200 items.  I have not really played with it much to
determine the actual times but its clear that something in the
calculator is quadratic if not exponential.

The particular thing I'm doing is I do a list-> to put the list onto
the stack and then I simply process the items one at a time with a for
loop.

So the question is can someone point out why this is not a good way to
do things and perhaps suggest a place where I can find out good and
bad programming practices to use with this beast.

Thanks
pedz

billw@hpcvra.CV.HP.COM (William C Wickes) (08/03/90)

You are probably running into the dark side of HP 28 garbage collection, which
is at its worst when you decompose a list into its elements and leave
those elements on the stack.  You should be able to solve the problem by
storing the list in a global variable BEFORE you use LIST-> (you can
purge the variable after you have finished with the elements).

This is my best guess, without seeing your program.

umapd51@sund.cc.ic.ac.uk (W.A.C. Mier-Jedrzejowicz) (08/03/90)

A thought on why HP28 operations on a list of 100 items might be
reasonably fast, while those on a list of 200 are much slower. If the
HP28 memory is nearly full when you have a list of 200 objects, then
theHP28 might be spending an inordinate amount of time doing repeated
garbage collection every time it gets really short of memory. Try
freeing up some memory - delete unwanted variables if possible. If not,
disable ONE of the LAST options (despite my message yestaerday warning
against disabling LAST options, this sometimes is necessary, but if at
all possible, disable either the stack or the argument saving, not both;
in this case, if you are editing long strings it may be best to disable
the command option).
Wlodek Mier-Jedrzejowicz, Space & Atmospheric Physics, Imperial College,
London

r91400@memqa.uucp (Michael C. Grant) (08/03/90)

In article <25590038@hpcvra.CV.HP.COM>, billw@hpcvra.CV.HP.COM (William C Wickes) writes:
> You are probably running into the dark side of HP 28 garbage collection, which
> is at its worst when you decompose a list into its elements and leave
> those elements on the stack.  You should be able to solve the problem by
> storing the list in a global variable BEFORE you use LIST-> (you can
> purge the variable after you have finished with the elements).
> 
> This is my best guess, without seeing your program.

Oh, my, a calculator doing garbage collection--when will it stop?

My father showed be a program he wrote in grad school that was several
inches high--on FORTRAN punchcards!  He said, "here you go Mike, if you
want to use it, load it onto the mainframe and it will do Bode plots for you."
.
.
.
"No thanks Dad, I just programmed my calculator to do those."

Michael C. Grant