Should global variables be pointers or full objects?

Member
Posts: 49
Joined: 2006.07
Post: #1
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?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
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.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  C: Global Variables versus Parameters Lizard Man 10 5,869 Jan 13, 2010 08:22 PM
Last Post: Lizard Man
  Accessing an inherited class's variables Tobs_ 22 9,131 Feb 28, 2007 05:26 PM
Last Post: mac_girl
  Problems with variables in Obj-C vnvrymdreglage 16 6,501 Oct 2, 2006 10:19 PM
Last Post: vnvrymdreglage
  where do global variables fall into the memory type? WhatMeWorry 3 2,769 Jun 5, 2006 02:45 PM
Last Post: OneSadCookie
  Arrays or variables containing executable functions Jones 4 4,394 Jun 2, 2006 08:35 AM
Last Post: Zekaric