As we are closing defects identified by Coverity and improving
constructors everywhere we are creating a minor anti-pattern in
MemPool'ed objects with calloc() in the pool initializing the memory
then constructors re-initializing it in a better way for that object.
MemPools contains a doZeroOnPush flag to optimize performance by
removing use of memset() as chunks are added back into the pool.
However, on closer inspection it is clear that the following pop()
process to re-use those chunks is never performing memset() anyway. As
such I believe that there is no special need to use calloc() on these
particular object types in the first place.
The attached patch updates MemPools to use malloc() instead of calloc()
on all types with doZeroOnPush set. This should increase performance a
little, and allows us to remove the anti-pattern by setting doZeroOnPush
for more objects as we can verify they are correctly initialized by
their constructors.
Amos
This archive was generated by hypermail 2.2.0 : Sat Jan 12 2013 - 12:00:10 MST