public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tlawrence85 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/54075] [4.7.1] unordered_map insert still slower than 4.6.2
Date: Mon, 05 Nov 2012 22:12:00 -0000 [thread overview]
Message-ID: <bug-54075-4-2DIeVTklzw@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-54075-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54075
Lawrence <tlawrence85 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tlawrence85 at gmail dot
| |com
--- Comment #36 from Lawrence <tlawrence85 at gmail dot com> 2012-11-05 22:12:12 UTC ---
It seems that this commit doesn't fully fix this issue. If you call rehash
multiple times with the same size, the second call to rehash resets
_M_prev_resize to a non-zero value in _M_next_bkt(). Here is a sample program
that shows this behavior:
#include <stdio.h>
#include <unordered_map>
int main(void) {
std::unordered_map<int, int> myMap;
myMap.rehash(4000000);
myMap.rehash(4000000);
unsigned long long buckets = myMap.bucket_count();
int i = 0;
while (i < 2000000000) {
myMap.insert(std::make_pair(i, 0));
++i;
if (buckets != myMap.bucket_count()) {
printf("buckets %lu -> %lu\n", buckets, myMap.bucket_count());
buckets = myMap.bucket_count();
}
}
return 0;
}
(In reply to comment #13)
> Author: fdumont
> Date: Thu Jul 26 12:31:50 2012
> New Revision: 189889
>
> URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189889
> Log:
> 2012-07-26 François Dumont <fdumont@gcc.gnu.org>
>
> PR libstdc++/54075
> * include/bits/hashtable.h
> (_Hashtable<>::_Hashtable(_InputIterator, _InputIterator,
> size_type, ...): Remove std::max usage to guarantee that hashtable
> state is consistent with hash policy state.
> (_Hashtable<>::rehash): Likewise. Set _M_prev_resize to 0 to avoid
> the hashtable shrinking on next insertion.
> * testsuite/23_containers/unordered_set/modifiers/reserve.cc: New.
> * testsuite/23_containers/unordered_multiset/modifiers/reserve.cc: New.
> * testsuite/23_containers/unordered_map/modifiers/reserve.cc: New.
> * testsuite/23_containers/unordered_multimap/modifiers/reserve.cc: New.
>
> Added:
>
> branches/gcc-4_7-branch/libstdc++-v3/testsuite/23_containers/unordered_map/modifiers/reserve.cc
>
> branches/gcc-4_7-branch/libstdc++-v3/testsuite/23_containers/unordered_multimap/modifiers/reserve.cc
>
> branches/gcc-4_7-branch/libstdc++-v3/testsuite/23_containers/unordered_multiset/modifiers/reserve.cc
>
> branches/gcc-4_7-branch/libstdc++-v3/testsuite/23_containers/unordered_set/modifiers/reserve.cc
> Modified:
> branches/gcc-4_7-branch/libstdc++-v3/ChangeLog
> branches/gcc-4_7-branch/libstdc++-v3/include/bits/hashtable.h
next prev parent reply other threads:[~2012-11-05 22:12 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-23 23:07 [Bug libstdc++/54075] New: [4.7.1] unordered_map 3x " likan_999.student at sina dot com
2012-07-23 23:08 ` [Bug libstdc++/54075] " likan_999.student at sina dot com
2012-07-23 23:09 ` likan_999.student at sina dot com
2012-07-23 23:12 ` paolo.carlini at oracle dot com
2012-07-23 23:23 ` paolo.carlini at oracle dot com
2012-07-24 0:17 ` likan_999.student at sina dot com
2012-07-24 0:29 ` paolo.carlini at oracle dot com
2012-07-24 0:43 ` likan_999.student at sina dot com
2012-07-24 10:42 ` plasmahh at gmx dot net
2012-07-24 20:15 ` fdumont at gcc dot gnu.org
2012-07-24 20:19 ` fdumont at gcc dot gnu.org
2012-07-25 9:56 ` paolo.carlini at oracle dot com
2012-07-25 19:33 ` fdumont at gcc dot gnu.org
2012-07-26 12:30 ` plasmahh at gmx dot net
2012-07-26 12:32 ` fdumont at gcc dot gnu.org
2012-07-26 17:36 ` paolo.carlini at oracle dot com
2012-07-26 22:10 ` likan_999.student at sina dot com
2012-07-26 22:50 ` chip at pobox dot com
2012-07-26 22:55 ` paolo.carlini at oracle dot com
2012-07-26 23:39 ` [Bug libstdc++/54075] [4.7.1] unordered_map insert " chip at pobox dot com
2012-07-27 0:33 ` redi at gcc dot gnu.org
2012-07-27 1:00 ` chip at pobox dot com
2012-07-27 7:58 ` fdumont at gcc dot gnu.org
2012-07-27 19:21 ` plasmahh at gmx dot net
2012-07-29 16:44 ` fdumont at gcc dot gnu.org
2012-07-29 17:06 ` fdumont at gcc dot gnu.org
2012-09-26 23:11 ` paolo.carlini at oracle dot com
2012-10-22 20:50 ` cracauer at cons dot org
2012-10-22 21:05 ` paolo.carlini at oracle dot com
2012-10-22 22:04 ` cracauer at cons dot org
2012-10-22 22:47 ` paolo.carlini at oracle dot com
2012-10-24 19:28 ` fdumont at gcc dot gnu.org
2012-10-25 17:48 ` cracauer at cons dot org
2012-10-26 14:35 ` paolo.carlini at oracle dot com
2012-11-03 15:28 ` fdumont at gcc dot gnu.org
2012-11-04 4:55 ` foom at fuhm dot net
2012-11-05 12:55 ` [Bug libstdc++/54075] [4.7.1] unordered_map insert still " paolo.carlini at oracle dot com
2012-11-05 22:12 ` tlawrence85 at gmail dot com [this message]
2012-11-06 0:59 ` paolo.carlini at oracle dot com
2012-11-06 21:23 ` fdumont at gcc dot gnu.org
2012-11-06 21:34 ` paolo.carlini at oracle dot com
2012-11-07 22:03 ` frs.dumont at gmail dot com
2012-11-08 0:59 ` jwakely.gcc at gmail dot com
2012-11-08 1:56 ` paolo.carlini at oracle dot com
2012-11-08 2:26 ` paolo.carlini at oracle dot com
2012-11-08 20:06 ` fdumont at gcc dot gnu.org
2012-11-08 20:16 ` fdumont at gcc dot gnu.org
2012-11-08 20:21 ` frs.dumont at gmail dot com
2012-11-08 21:19 ` frs.dumont at gmail dot com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-54075-4-2DIeVTklzw@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).