Should global variables be pointers or full objects?
Apple's docs recommend not to make any large classes global variables, so that they don't slow down the application launching time. They recommend using pointers that start out as NULL instead and then load the objects onto the heap as needed. I am wondering if that is really the best idea for games. I am new to game programming (though not to programming in general) and I've never had to worry about performance issues a lot before, so I don't have much of a feel for this, but isn't it going to slow the game down a lot if every other line of code requires a pointer trace? Or are pointer traces fast enough that it doesn't really matter?
I wouldn't worry about this kind of optimization at all... other things are far more likely to cause you speed problems than having large globals or not. Do what's easiest.
Possibly Related Threads...
|C: Global Variables versus Parameters||Lizard Man||10||5,514||
Jan 13, 2010 08:22 PM
Last Post: Lizard Man
|Accessing an inherited class's variables||Tobs_||22||8,751||
Feb 28, 2007 05:26 PM
Last Post: mac_girl
|Problems with variables in Obj-C||vnvrymdreglage||16||6,260||
Oct 2, 2006 10:19 PM
Last Post: vnvrymdreglage
|where do global variables fall into the memory type?||WhatMeWorry||3||2,678||
Jun 5, 2006 02:45 PM
Last Post: OneSadCookie
|Arrays or variables containing executable functions||Jones||4||4,204||
Jun 2, 2006 08:35 AM
Last Post: Zekaric