unordered_multimap/unordered_multiset optimizations

François Dumont
Wed Jun 19 17:32:00 GMT 2019


     Still influenced by PR 68303 this patch:

- Extend usage of find within other methods. It simplify code and will 
allow to implement the PR in less places if we decide to do so.

- Get rid of several bucket index comparison for non-unique key 
containers this way we have less hash code computations.

It also adds _M_update_bbegin cause I plan to propose another 
optimization regarding this special bucket maintenance.

     * include/bits/hashtable_policy.h (_Map_base<>::at): Use
     (_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

Tested under Linux x86_64, ok to commit ?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: hashtable.patch
Type: text/x-patch
Size: 12610 bytes
Desc: not available
URL: <>

More information about the Gcc-patches mailing list