public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "glisse at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/96088] Range insertion into unordered_map is less effective than a loop with insertion
Date: Thu, 09 Jul 2020 10:50:58 +0000	[thread overview]
Message-ID: <bug-96088-4-1fU8PXyRO9@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96088-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> ---

(In reply to Jonathan Wakely from comment #2)
> Or use unordered_map<string, int, hash<string_view>, equal_to<>> which
> should perform better.

Good idea.

> We haven't implemented http://wg21.link/p0919r3 and http://wg21.link/p1690r1
> yet, I wonder if those would help, especially if we make the internal
> helpers available pre-C++20. That could allow the range insertion to use the
> heteregenous lookup, to avoid creating temporaries. I'm not sure if that
> would be conforming though. Heterogeneous lookup is observably different,
> and not conforming in C++17.

Restricting it to a few standard types like string should not be observable.

> Adding hash<string>::operator()(string_view) is an interesting idea for the
> standard though.

Indeed. If we want to, I think it is possible to add some overloads for when
the argument is exactly const char* or string_view, which should remain
conforming and provide a significant part of the benefits.

  parent reply	other threads:[~2020-07-09 10:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-06 18:37 [Bug libstdc++/96088] New: " antoshkka at gmail dot com
2020-07-09  6:23 ` [Bug libstdc++/96088] " fdumont at gcc dot gnu.org
2020-07-09  8:31 ` redi at gcc dot gnu.org
2020-07-09 10:50 ` glisse at gcc dot gnu.org [this message]
2020-07-09 14:46 ` redi at gcc dot gnu.org
2020-08-04 17:36 ` fdumont at gcc dot gnu.org
2021-05-25 19:27 ` fdumont at gcc dot gnu.org
2021-06-02 12:33 ` cvs-commit 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-96088-4-1fU8PXyRO9@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).