Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
LVars vs GVars

Do we pay a performance penalty for using global variable versus local variables?

Does one put more overhead on the IV than the other?

Not really. It's just that locals don't accumulate and therefore don't run the risk of two things accidentally using them for different things and interfering with each other. Globals should only be used when you need to keep information around across actions. That's not for overhead reasons, just for good design reasons.

Otherwise use locals and they get thrown away once the action is complete. That also of course insures that they don't already exist each time an action is run, so you also can't accidentally screw yourself up by picking up previously set values when you didn't want to.
Dean Roddey
Explorans limites defectum
Thanks. I was just concerned that global variable might put a higher load on the system but it sounds like that's not the case.

Possibly Related Threads…
Thread Author Replies Views Last Post
  LVars and Floating Point pjgregory 1 1,504 07-25-2016, 09:46 AM
Last Post: Dean Roddey
  Are GVars persistent even after power is off? ghurty 4 2,295 01-10-2015, 03:46 PM
Last Post: ghurty
  Passing Cookies in Gvars? pjgregory 1 1,586 10-20-2011, 07:55 AM
Last Post: pjgregory
  question on if logic and GVars greymatter 2 1,771 06-16-2011, 04:22 PM
Last Post: greymatter
  LVars with popups jchurley 1 1,743 09-04-2009, 04:47 AM
Last Post: Mark Stega
  LVar/GVars in widgets froop 5 2,238 10-31-2008, 11:09 AM
Last Post: Dean Roddey
  Dynamic Widgets using GVars jmwhooper 2 1,614 11-25-2007, 03:11 PM
Last Post: jmwhooper
  GetText and LVars in Action bph 2 1,920 01-03-2007, 03:48 PM
Last Post: Dean Roddey

Forum Jump:

Users browsing this thread: 1 Guest(s)