Boost logo

Boost :

Subject: Re: [boost] [Intrusive]
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2017-08-27 08:08:43


On Sun, Aug 27, 2017 at 3:33 AM, Soul Studios via Boost
<boost_at_[hidden]> wrote:
>>>> Whether that is faster or not depends on many factors, primarilly the
>>>> use scenarios at hand. One can't make a general statement like that without
>>>> specifics. One factor that could make a vector more efficient than a list is
>>>> cache friendliness, but an intrusive list could exploit it as well if you
>>>> manage the storage appropriately.
>>>
>>> Examples please.
>>
>> Examples of what, exactly?
>
> Of scenarios where what you're saying is true. My benchmarks indicate that a
> list which allocates in chunks rather than individually only outperforms a
> vector of indexes to a vector of elements in the case where ordered
> insertion is very frequent (plf::list is the list in question: see
> http://www.plflib.org/benchmarks_haswell_gcc.htm#orderedlowmodification and
> http://www.plflib.org/benchmarks_haswell_gcc.htm#orderedhighmodification and
> http://www.plflib.org/benchmarks_haswell_gcc.htm#highmodification)

Then you already have an example - a list over elements in a
deque/vector, which is what I was referring to as a way to improve
cache friendliness.

But my main point was not about that. I was saying you have to
consider many factors such as your use cases, object size and typical
count, access patterns and what not before choosing one data structure
or the other. Depending on those factors you will have a different
preference in terms of performance, too. Take flat_map vs. std::map
for example - both are good in some uses and not so good in other.
Saying that flat_map is faster would be false.


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