From: Jan S. [mailto:[email protected]]
Another possibility is to implement a pool of objects directly into
ExpensiveObject or to create a layer above it.
That is an option, although I didn’t mention that one complicating
factor is that all this is happening in a repetitive,
update-frame-basis. I considered using object pools for a while, but it
was annoying to have to have the object pool itself running every frame
in order to reset the pool state, and to ensure that it ran before/after
all other methods.
Plus, because speed is an issue here, I prefer solutions that don’t
involve the overhead of a function/method call to get an Expensive
instance. (Of course, such a pool could be managed less cleanly as a
global array/index combo, or such.) But that’s less important for the
Thanks for the contribution to the thread for posterity; it is important
to keep pools in mind for this sort of problem.