From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4854B384402C; Thu, 9 Jul 2020 10:50:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4854B384402C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1594291858; bh=zZMzoMWm5CdKZy4sfPvodiAitCv8jT7EsmsFoBUX7EA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=C6rIGhC3Yr8TyxxPT747NFwk/L67/6b8KLB1Wv7wcDPMH9/6rWY1Itx1h7Li+NQYa NnomNP5Tx9mGQJW3yY6uDBUcJ7u55JGQ7cD8Sp7xl7W19cypNmjLKhW0c1FuVbf79T 4S3aol18S8yyzohOBRAD0AQV5yr9yws0SeRX+Rcw= From: "glisse at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: glisse at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jul 2020 10:50:58 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96088 --- Comment #3 from Marc Glisse --- (In reply to Jonathan Wakely from comment #2) > Or use unordered_map, equal_to<>> which > should perform better. Good idea. > We haven't implemented http://wg21.link/p0919r3 and http://wg21.link/p169= 0r1 > 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::operator()(string_view) is an interesting idea for t= he > 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.=