Boost logo

Boost :

Subject: Re: [boost] devector feedback request
From: Benedek Thaler (thalerbenedek_at_[hidden])
Date: 2015-07-26 15:49:47


On Sun, Jul 26, 2015 at 9:35 PM, Matthias Vallentin <
vallentin_at_[hidden]> wrote:

>
> From the documentation, it sounds like a devector is strictly superior
> to std::vector, as it offers a superset of functionality. It would be
> great if you could discuss a bit more the trade-offs, for example, in
> which cases a devector is inferior to a std::vector performance-wise.
>

Thanks for the feedback!

The only compromise I know about is using `unsigned` vs. `std::size_t` as
`size_type`, described in the docs:

" The devector class template intends to be a drop in replacement of std::
vector. However, to keep its size slim (16 bytes on 32 bit, 24 bytes on a
typical 64 bit architecture), its size_type is defined as unsigned int
which reduces max_size() to UINT_MAX. "

Assuming no small buffer optimization is used, devector should have the
same performance as std::vector. Unfortunately, I have no benchmarks to
prove it, yet. However, even if the current implementation falls behind
std::vector, that only means I missed some optimization, it shouldn't be
something inherent, to my understanding.

Benedek


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