[development] Variables, lookups, and memory usage

Allie Micka allie at pajunas.com
Fri Dec 16 14:59:24 UTC 2005


On Dec 16, 2005, at 6:45 AM, Robert Douglass wrote:
>
> I once suggested that the variable table should get a "realm"  
> column and that variable_get should load and static cache all the  
> variables one realm at a time.

That's what it does.

lookup_get( realm, name=null ) {
   static lookup = array()
   if (! isset(lookup[name]))  { populate lookup[name] array }
   if (name) return lookup[realm][name] else return lookup[realm]
}

Only in real code :)

Again, the original intention of the lookup module was not to use it  
for variables, but to store arbitrary name/value entries.

One could argue for or against using it to store variables/settings/ 
preferences information.  Personally, I'm on the fence.  When I  
considered doing that, I realized I was creating ambiguity between  
variables and lookups so I asked here.

What I'm taking from this conversation is that there's work in  
progress that makes variable setting more flexible (and possibly more  
efficient), but it will almost certainly not make it into 4.7 and is  
not part of a short-term solution.  I'll have to decide what's best  
for my needs at this time: sucking up the memory bloat or setting a  
weird dependency for modules.

Allie Micka
pajunas interactive, inc.
http://www.pajunas.com

scalable web hosting and open source strategies



More information about the development mailing list