Post Reply 
RPL programming questions
02-19-2014, 02:15 PM (This post was last modified: 02-19-2014 02:17 PM by HP67.)
Post: #10
RE: RPL programming questions
(02-19-2014 01:49 PM)David Hayden Wrote:  
(02-19-2014 09:52 AM)HP67 Wrote:  Curiously, David's example of locals is faster than Peacecalc's example using the stack only. This does not seem to make sense.
The difference is sysRPL vs userRPL.

I may have misread David's comments but I thought he posted times for his User RPL version using local variables. That's what I intended to ask about. David said "My 50g gives times of 23 secs for TGLO2 and 21 secs for TLOC2" and I was comparing that to Peacecalc's stack example where Peacecalc said "this proggie create five values on stacklevel one to five and in the loop these variables are recalled by PICK and immediately afterwards deleted." That took 26 seconds.

Your detailed explanation about local variable overhead (and additional programming tips about variable references) is what I hoped somebody would explain. Thank you very much for the info! I will read it over a few times to make sure I get it.

When you say the calculator has to scan through all the locals, I suppose you mean there is a linked list or table of locals. I was expecting a hash would have been used for this. I'm going to read up on as much internals doc as I can find. Thanks again!

(02-19-2014 01:49 PM)David Hayden Wrote:  Local variables with short names are pretty fast and they make the code MUCH easier to write, read and maintain. I'd code your program using them first. If performance becomes an issue then you can think about modifying it to use the stack.

That sounds pretty sensible although I find I don't like the nesting requirement and having to have something on the stack to create a local variable with is a little opposite of the way I would usually code something- I would tend to try to understand what variables I need and declare and use them, rather than only name them once they're on the stack.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RPL programming questions - HP67 - 02-17-2014, 01:54 PM
RE: RPL programming questions - peacecalc - 02-17-2014, 03:10 PM
RE: RPL programming questions - Joe Horn - 02-18-2014, 01:06 PM
RE: RPL programming questions - HP67 - 02-18-2014, 01:39 PM
RE: RPL programming questions - peacecalc - 02-18-2014, 07:15 PM
RE: RPL programming questions - DavidM - 02-18-2014, 11:31 PM
RE: RPL programming questions - HP67 - 02-19-2014, 09:52 AM
RE: RPL programming questions - HP67 - 02-19-2014 02:15 PM
RE: RPL programming questions - HP67 - 02-20-2014, 03:27 PM
RE: RPL programming questions - DavidM - 02-19-2014, 05:23 PM
RE: RPL programming questions - HP67 - 02-20-2014, 03:40 PM
RE: RPL programming questions - DavidM - 02-20-2014, 04:10 PM
RE: RPL programming questions - peacecalc - 02-19-2014, 04:15 PM
RE: RPL programming questions - HP67 - 02-20-2014, 04:36 PM
RE: RPL programming questions - RMollov - 02-24-2014, 12:47 PM



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