[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Audience for globals discussion?
- From: Matthew Wild <mwild1@...>
- Date: Wed, 18 Aug 2010 14:34:27 +0100
On 18 August 2010 13:51, Peter Hickman <firstname.lastname@example.org> 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.