-
- Downloads
libstdc++: Unordered containers merge re-use hash code
When merging 2 unordered containers with same hasher we can re-use the hash code from the cache if any. Also in the context of the merge operation on multi-container use previous insert iterator as a hint for the next insert. libstdc++-v3/ChangeLog: * include/bits/hashtable_policy.h: (_Hash_code_base<>::_M_hash_code(const _Hash&, const _Hash_node_value<_Value, true>&)): New. (_Hash_code_base<>::_M_hash_code<_H2>(const _H2&, const _Hash_node_value<>&)): New. * include/bits/hashtable.h (_Hashtable<>::_M_merge_unique): Use latter. (_Hashtable<>::_M_merge_multi): Likewise. * testsuite/23_containers/unordered_multiset/modifiers/merge.cc (test05): New test. * testsuite/23_containers/unordered_set/modifiers/merge.cc (test04): New test.
Showing
- libstdc++-v3/include/bits/hashtable.h 6 additions, 4 deletionslibstdc++-v3/include/bits/hashtable.h
- libstdc++-v3/include/bits/hashtable_policy.h 13 additions, 0 deletionslibstdc++-v3/include/bits/hashtable_policy.h
- libstdc++-v3/testsuite/23_containers/unordered_multiset/modifiers/merge.cc 22 additions, 0 deletions...suite/23_containers/unordered_multiset/modifiers/merge.cc
- libstdc++-v3/testsuite/23_containers/unordered_set/modifiers/merge.cc 43 additions, 0 deletions.../testsuite/23_containers/unordered_set/modifiers/merge.cc
Loading
Please register or sign in to comment