Boost logo

Boost :

From: Greg Colvin (Gregory.Colvin_at_[hidden])
Date: 2003-01-30 11:34:52


At 09:12 AM 1/30/2003, Peter Dimov wrote:
>From: "Greg Colvin" <Gregory.Colvin_at_[hidden]>
>> At 06:23 AM 1/30/2003, Peter Dimov wrote:
>> >
>> >To be fair, a factor of two improvement cannot just be shrugged off. But
>one
>> >point to keep in mind is that
>> >
>> >shared_ptr<X> px(new X);
>> >
>> >performs two allocations. We can optimize the count allocation until
>we're
>> >blue in the face but in a real project the whole expression will probably
>> >remain a bottleneck; so it's likely that X will acquire a class-specific
>> >operator new. And a X with a class-specific new can no longer be used
>with
>> >shifted_ptr.
>>
>> I read a paper yesterday from the latest OOPSLA proceedings
>> that argued that a class-specific new is almost never a win
>> compared to a high-quality general purpose allocator like
>> LEA.
>
>This is the argument I've been using every time the question of adding an optimized count allocator to shared_ptr came up.

The counter-argument is that the allocators
supplied by many vendors are nowhere near as
good as LEA. So it might be a good idea to
optionally use boost::pool in shared_ptr. And
it would be a good Boost project to provide a
high-quality replacement operator new.


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