Boost logo

Boost Users :

From: Klaus Nowikow (nowikow_at_[hidden])
Date: 2004-07-01 07:41:29


Peter Dimov wrote:
> Klaus Nowikow wrote:
> > 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:
> >
> > [...]
> >
> > 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.

Hmm. I'll have to think about this. Maybe the test was a bit
over-simplified. The real program would have a vector<C*>
where C is my class. I'll change the example (using object_pool)
and post the results.


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