[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Audience for globals discussion?
- From: Rob Kendrick <rjek@...>
- Date: Wed, 18 Aug 2010 12:28:19 +0100
On Wed, 18 Aug 2010 07:15:03 -0400
Patrick McCavery <email@example.com> wrote:
> None of my programs are "Lightroom" in size. Is it such a big deal to
> keep track of let's say 100 globals? What is the specific threshold
> for pollution?
It's difficult to put a number on it. Personally, I avoid globals
unless it's absolutely necessary.
> Everyone says globals are slower, any guesses on specifically how
> much slower? i.e half the speed of locals?
It's easy to test. But remember that globals involve a hash table
lookup in the function's environment table, where locals are just a
register. Also remember that there are a finite number of registers
In other words, I think it boils down to experimentation and personal