[PATCH][Hashtable 1/6] Code simplification/optimization
François Dumont
frs.dumont@gmail.com
Sun Nov 17 20:51:00 GMT 2019
This patch simplifies a number of implementations.
It tries as much as possible to avoid computing hash code. This is
especially true for the erase implementation in case of multi keys.
   * include/bits/hashtable_policy.h (_Map_base<>::at): Use
   _Hashtable<>::find.
(_Hashtable_base<>::_Equal_hash_code<>::_S_node_equals):New.
   (_Hashtable_base<>::_M_node_equals): New, use latter.
   * include/bits/hashtable.h (_Hashtable<>::_M_update_bbegin): New.
   (_Hashtable<>::_M_assign): Use latter.
   (_Hashtable<>::_M_move_assign): Likewise.
   (_Hashtable<>(_Hashtable<>&&)): Likewise.
   (_Hashtable<>(_Hashtable<>&&, const allocator_type&)): Likewise.
   (_Hashtable<>::swap): Likewise.
   (_Hashtable<>::find): Build iterator directly from _M_find_node result.
   (_Hashtable<>::count): Use _Hashtable<>::find.
   (_Hashtable<>::equal_range): Likewise.
   (_Hashtable<>::_M_erase(false_type, const key_type&)): Use
   _M_node_equals.
Tested under Linux x86_64.
François
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hashtable#2.patch
Type: text/x-patch
Size: 13676 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20191117/5e36bc70/attachment.bin>
More information about the Libstdc++
mailing list