public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/65641] unordered_map - __detail::_Mod_range_hashing is slow
Date: Thu, 02 Apr 2015 12:56:00 -0000	[thread overview]
Message-ID: <bug-65641-4-XzisAKrlyM@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-65641-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65641

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-04-02
                 CC|                            |fdumont at gcc dot gnu.org
     Ever confirmed|0                           |1
           Severity|normal                      |enhancement

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jens Breitbart from comment #2)
> 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.

That sounds promising, and worth pursuing.

> Any chance of getting such a change upstream?

I don't see why not, although unless you have a GCC copyright assignment on
file, or plan to get one (immediately, since it can take a while) it's better
*not* to give us a patch, because we can't use it anyway and there can be no
danger of using your code if we don't see it!

> 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?

I think you would need to use the _Hastable class template directly, rather
than via std::unordered_map. In theory that allows you to re-use the internals
with different policies, but in practice it's not very easy.


  parent reply	other threads:[~2015-04-02 12:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-31 14:20 [Bug libstdc++/65641] New: " j.breitbart at tum dot de
2015-03-31 17:29 ` [Bug libstdc++/65641] " redi at gcc dot gnu.org
2015-04-02 12:37 ` j.breitbart at tum dot de
2015-04-02 12:56 ` redi at gcc dot gnu.org [this message]
2015-05-02 18:35 ` glisse at gcc dot gnu.org

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-65641-4-XzisAKrlyM@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).