The Museum of HP Calculators

HP Forum Archive 14

[ Return to Index | Top of Index ]

Slow HP48GX
Message #1 Posted by Rick on 30 May 2004, 8:33 p.m.

Sometimes after running a lot of programs my GX tends to get extremely slow. I can come out of this by doing a warm start.. ON and C together. Is there a reason for the sluggish behavior?

      
Re: Slow HP48GX
Message #2 Posted by Wayne Brown on 31 May 2004, 6:54 a.m.,
in response to message #1 by Rick

Are these programs leaving a lot of stuff on the stack? If so, clearing the stack probably will speed it up without having to do a warm start.

      
Re: Slow HP48GX
Message #3 Posted by Vieira, Luiz C. (Brazil) on 31 May 2004, 7:08 a.m.,
in response to message #1 by Rick

Hi;

I observed this behavior when running thirdy-part programs written in SYS RPL or Assembly. And although Wayne is completely correct calling the attention to "trashed" data stuffing the stack (that would indeed slow the calculator down), I'd like to know if programs written this way are able to create variables or to "slice" memory in a way that the used space is not claimed back after the programs resume execution. If so, I guess that a warmstart would do. Anyway, are you willing to perform a test I was not able to so far? Before executing a warmstart, try [MEM], [ON][C] and [MEM] again. If the first [MEM] fix things out, you'll probably notice that the calculator is running in regular speed. If not, please check if the amount of free memory from the second [MEM] is bigger than the first one (I guess it will be).

And please, let us know what did you get!

Cheers.

Luiz (Brazil)

            
Re: Slow HP48GX
Message #4 Posted by Rick on 31 May 2004, 9:57 a.m.,
in response to message #3 by Vieira, Luiz C. (Brazil)

Luiz, you found the problem. After running the problem continuously I found that there was 1032 bytes less. Each time I run the program after that there was still less bytes available until I 'Killed' the program. Then it cam back to the original memory. Thanks. Even though the program created local variables it was just halted and this appears to have the 'variales ' in memory still. Thanks, now all I'll do is include a 'KILL' function at the end of the program.

                  
Re: Slow HP48GX
Message #5 Posted by Vieira, Luiz C. (Brazil) on 31 May 2004, 10:41 a.m.,
in response to message #4 by Rick

Hi, Rick;

That's good news. Anyway, there's something else to add to this particular fact you wrote about. Try this program: please, type it in and save it with any name.

« HALT 1 100 FOR X
  X 1 DISP I FREEZE
  NEXT X
»

Run it after saving it; it will halt prior to execute any command, right? At this very moment, purge it from memory. The program no longer exists, right? But the HALT indicator is still there. So go for it: press [left_arrow][CONT] and... What the h...!

Yeap! Any program you run in fact is copied in RAM and the copy is the one used to perform the program operations. I found this when debugging a program (late 80's) in an HP48SX and I realized that the altered program was not the one used after being saved, instead the original one. It was necessary to KILL program execution and start it again so the alterations made became effective. Than I tested the purging procedure I suggested above and I found that, in fact, the program is copied and maintained till it ends or is stopped. A halted program means a copy of it stored in memory and ready to go ahead.

Interesting, isn't it? You can write a program that purges itself as the first step and it will run anyway. Is it an impression of mine or I'm actually feeling some eyes widely open here...>>>8^O

Cheers!

Luiz (Brazil)

Edited: 31 May 2004, 11:54 a.m.

                        
Re: Slow HP48GX
Message #6 Posted by James M. Prange on 31 May 2004, 3:51 p.m.,
in response to message #5 by Vieira, Luiz C. (Brazil)

True. At least, it won't be completely removed from memory as long as there's a pointer to it (or any element of it) on the stack. For example, with a program stored in 'TempVar', you can start it with \<< 'TempVar' PURGE .... This is useful for running programs on a Kermit server from another calculator with the PKT command or from a Kermit program using REMOTE HOST, when the sequence is too many bytes for a single host command packet. For example, you can use the sequence 'TempVar' SEND "TempVar" "C" PKT.

Regards,
James

                  
Re: Slow HP48GX
Message #7 Posted by James M. Prange on 31 May 2004, 4:04 p.m.,
in response to message #4 by Rick

Maybe the program in question had a HALT command inserted for debugging purposes? If so, then just edit out the HALT. Or use LeftShift CONT (on the [ON] key) to resume execution of a suspended program. Using KILL in a program will work, but it's rather drastic, as it applies to all suspended programs, not just the current one.

Regards,
James


[ Return to Index | Top of Index ]

Go back to the main exhibit hall