[Bug libstdc++/54075] [4.7.1] unordered_map insert still slower than 4.6.2
Paolo Carlini
paolo.carlini@oracle.com
Wed Nov 14 10:55:00 GMT 2012
Hi,
On 11/13/2012 10:40 PM, François Dumont wrote:
> 2012-11-13 François Dumont <fdumont@gcc.gnu.org>
>
> * include/bits/hashtable_policy.h (_Prime_rehash_policy): Remove
> automatic shrink.
> (_Prime_rehash_policy::_M_bkt_for_elements): Do not call
> _M_next_bkt anymore.
> (_Prime_rehash_policy::_M_next_bkt): Move usage of
> _S_growth_factor ...
> (_Prime_rehash_policy::_M_need_rehash): ... here.
> * include/bits/hashtable.h (_Hashtable<>): Adapt.
>
> Tested under linux x86_64, normal and debug modes.
Patch is Ok with me, please wait another day or two for comments and
then apply it.
You can also add the performance testcase, of course, note however that
::random isn't a standard C function, thus we shouldn't use it
unconditionally, either manage with std::rand from <cstdlib> or do
something completely different (maybe even <random> since you are
writing C++11 code anyway!). I would also recommend extending quite a
bit the runtime, 10x would be still completely sensible (but I guess,
without using much more memory)
Paolo.
More information about the Libstdc++
mailing list