Boost logo

Boost :

From: Darren Cook (darren_at_[hidden])
Date: 2003-05-06 07:03:22


I've been comparing boost:pool to normal new/delete, and a couple of other
algorithms. My results are shown below - not a very good profile test as it
is too short and too general (and the pooling is only applied to one class),
but good enough to show a trend.

MemoryPool1 is based on Item 10 of Effective C++ by Scott Meyers.
MemoryPool2 is similar but uses a vector of pointers insted of a union.

Is Boost::Pool doing something time-consuming that not all applications
need? E.g. my two MemoryPool classes require the block size to be specified
as a template parameter. Also there is no allowance for getting a pointer to
more than one object.

Is there interest in a "SimplePool" class that is quicker and less flexible?

Darren

Class size=5444 bytes, 75,358 allocations, peak usage is 290 objects.
gcc 3.2, -03 optimization.

* Testing on a real-world example, gave:
* 2.74..2.79s for normal new/delete,
* 2.70..2.72s for MemoryPool1 (block size of 300)
* 2.69..2.76s for MemoryPool1 (block size of 10, ie. 29 block allocs)
* 2.71..2.73s for MemoryPool2 (block size of 300)
* 2.71..2.73s for MemoryPool2 (block size of 10, ie. 29 block allocs)
* 2.75..2.77s for Boost::Pool (using malloc/free)
* (throwing away highest/lowest time for each, 6-10 test runs for each)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk