Paul Herring wrote: > > > On Mon, Apr 20, 2009 at 8:58 PM, Christopher Coale > <[email protected] <mailto:chris95219%40gmail.com>> wrote: > > its going to be a lot faster to work > > with pointers than to copy around data for every little thing you do. > > Or there's references. > > Or there's the fact that it /may/ make little difference to the speed > of the code if it's dealing with pointers to objects, references to > objects or the objects themselves. > > If you're dealing with creating/deleting objects in the innermost loop > that's running for 99% of the time when your application is running > for days, it will make a substantial difference. > > If, on the other hand, it's maybe a one off occurrence, or something > that might happen 0.1% of the time in your code (when most of the > other 99.9% is waiting for user input or disk I/O) then it really > doesn't matter. > > Which goes back to my first question - > > On Mon, Apr 20, 2009 at 4:23 PM, Paul Herring <[email protected] > <mailto:pauljherring%40gmail.com>> wrote: > > On Mon, Apr 20, 2009 at 4:18 PM, Jos Timanta Tarigan > > <[email protected] <mailto:jos_t_tarigan%40yahoo.com>> wrote: > >> is there any point of creating a vector of pointer for efficiency > stuuff? > > > > Do you have an efficiency problem? > > Guestimating where bottlenecks exist is not a productive use of any > programmer's time - that's why profilers exist. > > And that's exactly what the rest of you are doing - guestimating. None > of you have any idea what the OP's program does, nor where it spends > most of its time - and I suspect the OP doesn't either; hence my > question. > > -- > PJH > > http://shabbleland.myminicity.com/ind > <http://shabbleland.myminicity.com/ind> > http://www.chavgangs.com/register.php?referer=9375 > <http://www.chavgangs.com/register.php?referer=9375> > > I come from a background of game development, so speed is always an issue for me. I tend to pick out the littlest of things, and make a big deal about them (such as using division when multiplication could be used, passing by-pointer instead of by-value, etc.) Storing a list of references is not a good idea because they will unintentionally lose their scope unless you have a reference to a global variable, which isn't usually the case. God gave us pointers (and C++ gave us "new" and "delete") for a reason - let's use them. :)
On top of that, the stack really shouldn't be used for general storage anyways - that's what the heap is for.
