|
Boost : |
Subject: [boost] [flat_set] When to sort?
From: Vladimir Batov (Vladimir.Batov_at_[hidden])
Date: 2017-03-26 03:02:39
I've been using boost::container::flat_set with quite a success until
recently when I profiled my app to see that 30-50% of the run-time was
spent in insert() for a container of around 50,000 in size.
So, I had to replace boost::container::flat_set with a vector variation
which inserts as a vector (no sorting). However, when it is the time to
call begin(), end(), find(), it sorts once. That shaved the mentioned
overhead off. Say, one run is down from 17s to 10s and the likes.
I wonder if that should be the boost::container::flat_set default
behavior rather than sorting the underlying container with every
insert(). After all, as a user I do not care if the underlying container
is sorted... until I start using/traversing it, right? Or maybe I am
missing something in boost::container::flat_set which already allows me
to do something of that sort?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk