1 Reply Latest reply on Jul 3, 2006 2:25 PM by Newsgroup_User

    global or local variables for speed?

    www.gamesmaken.pagina.nl Level 1
      Hi, anyone an idea?

      is it faster to use global variables or (sprite)properties or Object properties?
      In other words is it smart to use as less globals as possible or not (in terms of speed)? Or does it not make a diffrence.

      Thanks!

      www.seriousgames.startpagina.nl
        • 1. Re: global or local variables for speed?
          Level 7
          In general, use the less globals possible, for various reasons (clearer &
          safer code, ability to reuse names etc.).
          In terms of speed, local variables are faster in most languages
          (hierarchical, local definitions checked first + fewer entries to search
          for). In director however, any difference will hardly be noticeable, since
          the lingo line execution overhead leaves no room for sub or close to
          nanosecond optimization considerations.


          "www.gamesmaken.pagina.nl" <webforumsuser@macromedia.com> wrote in message
          news:e8brrf$833$1@forums.macromedia.com...
          > Hi, anyone an idea?
          >
          > is it faster to use global variables or (sprite)properties or Object
          > properties?
          > In other words is it smart to use as less globals as possible or not (in
          > terms
          > of speed)? Or does it not make a diffrence.
          >
          > Thanks!
          >
          > www.seriousgames.startpagina.nl
          >