3 ms·
Your comment has a gaping lack of real world profiling and "it depends", so that's likely why it's getting downvoted. > most code will start running much more
by lionkor 3y ago
Your comment has a gaping lack of real world profiling and "it depends", so that's likely why it's getting downvoted.
> most code will start running much more slowly
Most code, as in, most code that uses it? Are there are stats on how exactly std::map (and std::unordered_map, the more useful general purpose map) are used?
- tialaramex 3y ago> and std::unordered_map, the more useful general purpose map std::unordered_map is a hash table. It's not a very good hash table but that's what it is, and so whilst that is much more generally useful, it's also irrelevant to the purpose of map (and thus of flat_map). It seems to me that if "most code" would be harmed by using flat_map instead of map that's actually good news, since map isn't going anywhere. What I anticipate is the reality is that a considerable amount of code would benefit from using flat_map instead of map, because of the improved performance from linear access.