[Bug libstdc++/54075] [4.7.1] unordered_map insert still slower than 4.6.2
Paolo Carlini
paolo.carlini@oracle.com
Fri Nov 9 10:51:00 GMT 2012
Hi again,
+ // To get previous bound we use _S_growth * 2 to avoid ocillations in the
+ // number of buckets when looping on insertion/removal of elements.
const unsigned long* __prev_bkt
- = std::lower_bound(__prime_list + 1, __next_bkt, __n / _S_growth_factor);
+ = std::lower_bound(__prime_list + 1, __next_bkt,
+ __n / _S_growth_factor / _S_growth_factor);
Looks like, here you are dividing by _S_Growth ^ 2? Is it intended? But
anyway, in my opinion the very my _M_prev_resize idea (thus rehash
shrinking, right?) is proving quite fragile and we also got negative
comments from the users about shrinking, which is new. Before pursuing
it further, I think we should double check what the other
implementations do, are they also shrinking? Because otherwise we could,
at least for the time being, remove the related bits and save ourselves
many headaches...
Paolo.
More information about the Libstdc++
mailing list