Post Reply 
Basic RPL question
02-28-2016, 11:28 PM
Post: #22
RE: Basic RPL question
Quote:Just read in the manuals where they suggested using local variables instead of global variables for speed and memory reasons
Local variables are implemented as a pointer to the name and a pointer to the object. When you store to a local variable, the calculator just has to update the object pointer.

Global variables are implemented as a copy of the name and a copy of the object. When you store to a global variable, the calculator has to copy the entire object. What's worse, if the size of the new object is different from the size of the old one, then the calculator has to move part of user memory to ensure that the object fits.

So if you're using small objects in your variables and they don't change size (like real numbers) then local and global variables are pretty comparable, but if you store large objects that change size (like lists that grow), then local variables can be much faster.

Quote:Test1: 18.37 seconds
Test2: 2.12 seconds
Wow that's quite a difference. Does anyone know why the algebraic is so much slower? I would have thought that they'd be nearly identical.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Basic RPL question - Graan - 02-25-2016, 03:05 PM
RE: Basic RPL question - rprosperi - 02-25-2016, 03:19 PM
RE: Basic RPL question - David Hayden - 02-25-2016, 03:36 PM
RE: Basic RPL question - wojtek - 02-25-2016, 04:25 PM
RE: Basic RPL question - Graan - 02-25-2016, 07:53 PM
RE: Basic RPL question - David Hayden - 02-25-2016, 08:32 PM
RE: Basic RPL question - wojtek - 02-25-2016, 08:48 PM
RE: Basic RPL question - Graan - 02-25-2016, 08:54 PM
RE: Basic RPL question - wojtek - 02-25-2016, 08:35 PM
RE: Basic RPL question - Graan - 02-28-2016, 09:56 AM
RE: Basic RPL question - wojtek - 02-28-2016, 10:14 AM
RE: Basic RPL question - Paul Dale - 02-28-2016, 10:13 AM
RE: Basic RPL question - Graan - 02-28-2016, 01:02 PM
RE: Basic RPL question - DavidM - 02-28-2016, 03:27 PM
RE: Basic RPL question - rprosperi - 02-28-2016, 06:13 PM
RE: Basic RPL question - Graan - 02-28-2016, 07:00 PM
RE: Basic RPL question - Han - 02-28-2016, 02:26 PM
RE: Basic RPL question - Graan - 02-28-2016, 03:22 PM
RE: Basic RPL question - Graan - 02-28-2016, 05:05 PM
RE: Basic RPL question - DavidM - 02-28-2016, 06:23 PM
RE: Basic RPL question - Tugdual - 02-28-2016, 10:01 PM
RE: Basic RPL question - David Hayden - 02-28-2016 11:28 PM
RE: Basic RPL question - DavidM - 02-29-2016, 12:30 AM
RE: Basic RPL question - wojtek - 02-29-2016, 12:39 AM
RE: Basic RPL question - Claudio L. - 02-29-2016, 03:48 AM
RE: Basic RPL question - Han - 02-29-2016, 04:19 AM
RE: Basic RPL question - DavidM - 02-29-2016, 05:22 AM



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