Boost logo

Boost :

Subject: Re: [boost] [utility] new auto_buffer class --- RFC
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2009-03-02 14:31:56

Felipe Magno de Almeida skrev:
> On Mon, Mar 2, 2009 at 3:59 PM, Thorsten Ottosen
> <thorsten.ottosen_at_[hidden]> wrote:
>> Felipe Magno de Almeida skrev:
> [snip]
>>> Can't push_back call reserve if it doesn't fit? That way push_back could
>>> still be inlineable. Or am I missing something?
>> Last I checked, vector<T>::push_back() was not inlined, no matter the
>> optimization level. The whole involvement of the allocator, and copying
>> of elements on expansion seems to tell the compile it is inadvisable.
> I see, And auto_buffer::push_back is inlined?

At least it is much more likely to be. Again, the standard doesn't
guarantee it.

> Have you tried with the buffer expansion check?
> I still advocate for a growing push_back even if it is not inlined, and
> adding a unchecked_push_back if somebody needs more performance.

Yes, but are needed.

>> And then there is the additional check for buffer expansion.
> I would think this check would be quite unexpensive.

Yeah, probably small compared to the function not being inlined.
But still an overhead we would like to avoid if possible.


Boost list run by bdawes at, gregod at, cpdaniel at, john at