|
Boost : |
Subject: Re: [boost] [utility] new auto_buffer class --- RFC
From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2009-03-02 18:11:58
On Mon, Mar 2, 2009 at 17:56, Matt Calabrese <rivorus_at_[hidden]> wrote:
> On Mon, Mar 2, 2009 at 4:32 PM, Thorsten Ottosen <
> thorsten.ottosen_at_[hidden]> wrote:
>
>> Christopher Jefferson skrev:
>>>
>>> You could make exactly the same argument about pushing back into a vector,
>>> why not have a push_back_unchecked that doesn't check if reallocation must
>>> occur. I did once experiment with this and got no measurable speed
>>> improvement.
>>>
>>
>> So did I in a real-time ray-tracing application. The difference was a
>> deal-breaker.
>
>
> I definitely see this tool as being all about low-level optimization, which
> is one of the few things we can say almost for certain concerning its domain
> of usage, so it might as well directly offer as much functionality in that
> regard as possible.
>
LLVM has a similar class, FWIW:
http://llvm.org/docs/ProgrammersManual.html#dss_smallvector
It seems to be entirely about reducing heap overheads, though, with
apparently no need for *_unchecked functions.
It seems to me that if you need unchecked, then the class shouldn't be
storing the capacity at all (outside of debug versions), as it's
unnecessary overhead, which suggests to me that it would be the domain
of a separate, obviously unsafe class (unchecked_vector?).
~ Scott
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk