This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/54075] [4.7.1] unordered_map 3x slower than 4.6.2
- From: "fdumont at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 24 Jul 2012 20:15:10 +0000
- Subject: [Bug libstdc++/54075] [4.7.1] unordered_map 3x slower than 4.6.2
- Auto-submitted: auto-generated
- References: <bug-54075-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54075
--- Comment #9 from FranÃois Dumont <fdumont at gcc dot gnu.org> 2012-07-24 20:15:10 UTC ---
I confirm that the reserve method is broken. I had correctly handle the size
hint that can be given through the hashtable constructor, I set
_M_rehash_policy._M_prev_resize to 0 just to avoid the container to be shrink
until it reaches the targetted size. The same thing should be done in the
rehash method that is called from reserve one. I will submit a patch soon.
Regarding the shrink on insert calls, well, it can be easily avoided by calling
(normally) reserve so I considered that it is better to offer a container with
a symetric behavior.
I will also I think reconsider the grow factor. During one of my propositions
of hashtable redesign the number of empty buckets was a problem for
performance. With the current implementation it is not a problem anymore so we
could grow a little bit faster.