This is an implementation of PR 68303. I try to use this idea as much as possible to avoid computation of hash codes. Note that tests are not showing any gain. I guess hash computation must be quite bad to get a benefit from it. So I am only activating it when hash code is not cached and/or when computation is not fast.     PR libstdc++/68303     * include/bits/hashtable_policy.h     (_Small_size_threshold<_Hash>): New.     (_Hashtable_traits<>): Add _Small_size_threshold std::size_t template     parameter, default to 0.     (_Hashtable_traits<>::__small_size_threshold): New.     (_Hash_code_base<>::_M_hash_code(const __node_type*)): New.     (_Equal_helper<>::_S_node_equals): New.     * include/bits/hashtable.h:     (__small_size_threshold_default<>): New template alias.     (_Hashtable<>::find): Add linear lookup when size is lower or equal to     _Small_size_threshold.     (_Hashtable<>::_M_emplace<_Args>(true_type, _Args&&...)): Add linear     lookup when size is lower or equal to _Small_size_threshold.     (_Hashtable<>::_M_insert<>(_Arg&&, const _NodeGenerator&, true_type,     size_type)): Likewise.     (_Hashtable<>::_M_compute_hash_code(const_iterator, const key_type&)):     New.     (_Hashtable<>::_M_emplace<_Args>(false_type, _Args&&...)): Use latter.     (_Hashtable<>::_M_insert(const_iterator, _Arg&&, const _NodeGenerator&,     false_type)): Likewise.     (_Hashtable<>::_M_find_before_node(const key_type&)): New.     (_Hashtable<>::_M_erase(true_type, const key_type&)): Use latter if size     is lower or equal to _Small_size_threshold.     (_Hashtable<>::_M_erase(false_type, const key_type&)): Likewise.     * include/bits/unordered_map.h (__umaps_traits): Adapt using small size     threshold set to 20.     (__ummap_traits): Likewise.     * include/bits/unordered_set.h (__uset_traits, __ummset_traits): Likewise.     * src/c++11/hashtable_c++0x.cc: Add include. Tested under Linux x86_64. François