From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A41F33945057; Sun, 27 Sep 2020 23:34:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A41F33945057 From: "mattreecebentley at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/96750] 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10 Date: Sun, 27 Sep 2020 23:34:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: unknown X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: mattreecebentley at gmail dot com X-Bugzilla-Status: NEW 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: Sun, 27 Sep 2020 23:34:42 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96750 --- Comment #5 from Matt Bentley --- If anyone out there is interested in working on this,=20 I found the smallest change possible to create the same performance as GCC8= -=20 it is literally eliminating one branch possibility in one function (move-insert). The branch in question questions whether there are existing memory blocks to re-use or if we need to create a new memory block. For example, if the reserve() function has been called there will be existing memory blocks to re-use. However the performance drop occurs whether or not there are memory blocks = to reuse. The actual if statement is irrelevant. I have tested and can remove = all instances of memory block storage (reserve(), erase()) and problem still ex= ists if this one branch is still in insert. I've attached the source files to demonstrate this above, including one plf_colony.h with the branch removed (renamed to plf_colony_fast.h), so you= can see what difference there is. This code is all zlib license, free to share, but is early beta so don't redistribute please. Thanks, Matt ps. For consistency I've also removed the non-move-insert and emplace insta= nces of this branch statement, even though they won't be called by the benchmark code in a C++11-compliant compiler.=