|
Boost : |
From: Martin Duvanel (martin.duvanel_at_[hidden])
Date: 2021-09-06 19:10:05
Hello,
We are using boost::icl::interval_set with very large amounts of intervals, and we are having some performance issues.
Profiling showed that, in our use-case, a lot of time was spent on memory allocation/deallocation, and swapping std::set for boost::flat_set made a huge, positive difference.
We may have a very specific use-case, but would you consider a small modification to the library inside "boost/icl/impl_config.hpp", in order to open the door for other set/map implementations?
Here is the simple change we made to "boost/icl/impl_config.hpp" for this experiment:
<code>
#if defined(ICL_USE_BOOST_MOVE_IMPLEMENTATION)
# define ICL_IMPL_SPACE boost::container
#elif defined(ICL_USE_STD_IMPLEMENTATION)
# define ICL_IMPL_SPACE std
+ #elif defined(ICL_USE_CUSTOM_IMPLEMENTATION)
+ # define ICL_IMPL_SPACE ICL_CUSTOM_IMPL_SPACE
#else
# define ICL_IMPL_SPACE std
#endif
</code>
And then declaring the following before including:
<code>
namespace custom_icl
{
template <class Key, class T, class Compare, class Allocator>
using map = boost::container::flat_map<Key, T, Compare, Allocator>;
template <class Key, class Compare, class Allocator>
using set = boost::container::flat_set<Key, Compare, Allocator>;
} // namespace custom_icl
#define ICL_USE_CUSTOM_IMPLEMENTATION 1
#define ICL_CUSTOM_IMPL_SPACE custom_icl
</code>
Would such a change make sense in your opinion? If that's the case, then I would be happy to participate in the contribution.
Thank you and best regards,
Martin Duvanel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk