Boost logo

Boost :

Subject: Re: [boost] [container] boost::container::vector, hybrid_vector, and performance
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2013-02-13 09:36:19


Vadim Stadnik wrote:
> On Wed, Feb 13, 2013 at 10:14 AM, Adam Wulkiewicz <adam.wulkiewicz_at_[hidden]
>> wrote:
>
> I saw that varray has some optimizations for trivial types (dispatching
>>> to memcpy) that boost::container misses. Maybe a fairer comparison would
>>> be to use a simple class instead of std::size_t as the basic type.
>>> Something like "copyable_int" in boost/libs/container/movable_**int.hpp:
>>>
>>
>> In my test non-POD types were stored in containers, i.e. Box and
>> std::pair<Box, ptr> where Box is box<point<double, 2, cartesian> >.
>>
>>
> For non-POD types locality of reference has quite significant effect on
> results of performance tests. Access to values through pointers is more
> costly against POD values. Non-POD types hardly can be useful for reliable
> performance measurements even for containers with small number of elements.
> The size of a single element std::pair<Box,ptr> is another factor that
> should have an effect on performance.
>

You're right. And this is what makes containers fast - locality and size
for better caching, smaller methods for inlining. Because of that varray
will probably always be faster than any vector. We were more concerned
about the container::vector performance in relation to std::vector.

Regards,
Adam


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