This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/65641] unordered_map - __detail::_Mod_range_hashing is slow
- From: "j.breitbart at tum dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 02 Apr 2015 12:36:58 +0000
- Subject: [Bug libstdc++/65641] unordered_map - __detail::_Mod_range_hashing is slow
- Auto-submitted: auto-generated
- References: <bug-65641-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65641
--- Comment #2 from Jens Breitbart <j.breitbart at tum dot de> ---
Thanks for the link. I am not sure if there is really any benefit of using
libdivide instead of the masking.
I'll attach a first version of patch in which the functor stores the mask. Any
comments welcome, I am not familiar with the library.
Another possible solution would be to allow the number of buckets to be a power
of two, as one can easily compute the mask for such cases. This could be
triggered by the user explicitly calling rehash() with a power of two as the
parameter. Increasing the number of buckets would only increase to another
power of two. _Mod_range_hashing could check if the number of buckets is a
power of two and use masking in that case. This would not require an ABI
change.
Any chance of getting such a change upstream? As far as I can see, there seems
to be no easy way to have the unorered_map use our folding functor instead of
_Mod_range_hashing or am I missing something?