[libcxx-commits] [libcxx] [libc++] Avoid key_eq calls in hash_table rehash (PR #216551)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Aug 18 06:18:27 PDT 2026
xbcnn wrote:
If we compare hashes instead of keys, extra elements with different keys but the same hash might also be included. However, this is fine because their order is not required by the standard.
Eg.
If hash(k1) == hash(k2), the list
... _**{h1, k1, v1} -> {h1, k1, v2}**_ -> {h1, k2, v3} ...
now rehash, currently it goes:
... {h1, k2, v3} -> _**{h1, k1, v1} -> {h1, k1, v2}**_ ...
with this patch:
... _**{h1, k1, v1} -> {h1, k1, v2}**_ -> {h1, k2, v3} ...
Seems better, and faster. What do you think? @philnik777
https://github.com/llvm/llvm-project/pull/216551
More information about the libcxx-commits
mailing list