lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 18 August 2010 13:51, Peter Hickman <peterhickman386@googlemail.com> wrote:
> If your issue with globals is performance then the question is how
> frequently a running program will reference them.
>
> If  program has a two or three globals that are referenced all over
> the place then you will see some performance hit. Especially if they
> are embedded in some tight loops.
>

As Luiz points out, using globals is not a performance "hit". Using
locals is a performance "gain" ;)

I believe the argument against globals is much stronger in terms of
maintainability than performance - i.e. I'd argue the same even if
globals and locals had the same cost to reference them.

Matthew