但在临界值之下,采用整型键的flat_map的插入性能相较map有20%到70%的提升,甚至优于unordered_map。 字符串键相较整型键的性能更差(对所有容器而言),这时flat_map的插入耗时将有100%-200%的增长,并且上述的临界值显著降低。主要原因是:1. 字符串的比较和hash函数相较整型更为耗时;2. 使用字符串键导致flat_...
This is not a bug report, more of an interesting data point. In the past week I've been trying out absl::flat_hash_map and google::dense_hash_map (and sets) and comparing performance to STL counterparts. The following gist contains bench...
They work just like you would expect Sets to: they contain a collection of unique, unordered elements, and they allow you to see whether an element is in the set, whether one set is a subset of another, iterate over their elements, etc. Now, back to getting from the word/tag pairs ...