posted 14 years ago
Also, it should be noted that the comparison you want to make is between 'upfront creation of a pool of objects and on-demand use of them' as opposed to 'on-demand creation of objects'. The comparison is NOT between using 'new' to create an object vs. some other way of creation (whatever that might be).
The upfront creation of objects in pool is also (mostly) done via 'new', I believe. The other ways include reflection and deserialization, which cannot be faster than 'new' anyway.
So, it all boils down to - Is the creation of the object in question too expensive (constructor takes too long), so much so, that it can't be used on-demand?
If yes, pool the objects. However, be careful about reusing methodology if they are stateful.
If not, stick with KISS principle, and use on-demand 'new'.
Hope this helps.