Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-07-01 07:23:15


Klaus Nowikow wrote:
> Hi!
>
> I am in the process of writing a program which has to
> handle large numbers (~200000 - 400000) objects of the same class.
> These objects will be created and deleted frequently, so I thought
> some kind of specialized memory management would be handy.
>
> I wrote a test program (see below) to check what boost.pool would gain
> me. The results make me think that I have done something wrong:
>
> debug mode:
> std::allocator 2.17s
> boost::pool_allocator 7.18s
>
> release mode:
> std::allocator 0.11s
> boost::pool_allocator 0.36s
>
> i.e., std::allocator was more than 3 times faster than
> boost::pool_allocator (Win2k, 256MB). Any ideas what i have done
> wrong?

[...]

> template <class Allocator>
> double Test()
> {
> std::vector<Allocator::value_type, Allocator> Vector;
> boost::timer Timer;
>
> for(int i = 0; i < NUM_ELEMENTS; ++i)
> {
> Vector.push_back(i);
> }
>
> return Timer.elapsed();
> }

If I read the code correctly, you don't create or delete objects. You create
and delete (large) arrays of objects.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net