May I suggest that you use boost::unordered_map instead of
boost::unordered_flat_map
for those small maps and see if this improves the performance of
your program?
Thank you for the suggestion, I was hoping to keep all the elements sequentially in memory(general preference to make efficient use of cache, hard to microbenchmark), I will probably just stick to linear search or try my luck with flat_map(that in my experience has quite bad performance, but might work fine for this case).