|
Boost : |
Subject: Re: [boost] [container] small_flat_set and small_flat_map
From: Sam Kellett (samkellett_at_[hidden])
Date: 2016-10-19 15:34:36
On 19 October 2016 at 19:42, Chris Glover <c.d.glover_at_[hidden]> wrote:
> [snip]
>
>
> Flat containers are especially
> > useful with small number of (small) elements because they are
> > cache-friendly, and small size optimization makes perfect sense to
> > improve that use case even further.
> >
>
> It is my experience that the flat containers *always* outperform the node
> based containers on searching. So when the data is stable, I always use a
> flat container regardless of how many elements are in the container.
>
> One of the problems with that approach is that, because insert is slow, I
> often have to build up a std::vector of items, sort it and then copy them
> into the flat container using the ordered_unique_t overload. If this change
> was done in a way that allowed me to pass ownership of that sorted vector
> to the flat_* container, that would be an additional optimisation I would
> find useful.
>
yeah i agree, although that's a different piece of work, no? i've mentioned
this before[1] and i'm pretty sure it's on the roadmap (i've seen it
mentioned since).
[1] http://lists.boost.org/Archives/boost/2015/09/225568.php
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk