In a program I am working on, a huge percentage of time is spent in the default allocator allocating memory for a std::unordered_map. The map has data added and removed frequently, and the allocations that happen on every insert are limiting the program's performance. (Performance is particularly bad because all 64 cores on the machine are allocating/deallocating nodes of the same type, and there seems to be contention for some internal lock.)
In order to improve performance and lower allocator pressure, I'm trying to use a pool allocator (boost::object_pool) in order to reuse memory. In addition, I expect there may be some performance gain in the program from data locality improvements if the keys/values are stored in a local pool.
std::unordered_map seems to allocate memory for hashes, and separately for the key-value pairs objects (as std::pair<const Key, Value>). However, there's only one allocator template parameter, and this seems to set the allocator used for both objects. How can I use different allocators for these two things?
In some circumstances, I see std::scoped_allocator_adaptor suggested, but as best I can tell this is actually for specifying different allocators in nested containers, rather than within the same container.