public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96750] New: 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10
@ 2020-08-23  6:03 mattreecebentley at gmail dot com
  2020-08-24  8:47 ` [Bug middle-end/96750] " marxin at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: mattreecebentley at gmail dot com @ 2020-08-23  6:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96750
           Summary: 10-12% performance decrease in benchmark going from
                    GCC8 to GCC9/GCC10
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mattreecebentley at gmail dot com
  Target Milestone: ---

Created attachment 49102
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49102&action=edit
Compiler output

Have recently been working on a new version of the plf::colony container
(plflib.org) and found GCC9 was giving ~10% worse performance on average in a
given benchmark than GCC8. Further investigation found GCC10 was just as bad.

The effect is repeatable across architectures - I've tested on xubuntu, windows
running nuwen mingw, and on Core2 and Haswell CPUs, with and without
-march=native specified.

Compiler flags are: -O2;-march=native;-std=c++17

Code presented is with an absolute minimum use-case - other benchmarks have not
shown such strong performance differences - including both simpler and more
complex tests.
So I cannot reduce further, please do not ask me to do so.

The benchmark in question inserts into a container initially then iterates over
container elements repeatedly, randomly erasing and/or inserting new elements.

Compilers/environments used:
Xubuntu 20: GCC8.4, GCC9.3, GCC10.0.1
Windows 7: Nuwen mingw GCC8.2, nuwen mingw GCC9.2

The attached code output is from the Xubuntu environment.

Any questions let me know. I will help where I can, but my knowledge of
assembly is limited.

Information on code components:
Nanotimer is a ~nanosecond-precision sub-timeslice cross-platform timer.
Colony is a bucket-array-like unordered sequence container.

The attached zip contains the build logs and compiler preprocessed outputs for
GCC 8.4, 9.3 and 10.0.1

Thanks-
Mat

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug middle-end/96750] 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10
  2020-08-23  6:03 [Bug c++/96750] New: 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10 mattreecebentley at gmail dot com
@ 2020-08-24  8:47 ` marxin at gcc dot gnu.org
  2020-08-24  9:17 ` glisse at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-08-24  8:47 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-08-24
                 CC|                            |hubicka at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with r9-5763-g61a8637c8893a252:

after:
1794240.0

before:
1802710.0

Anyway, using PGO one can get to:
1488310.0

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug middle-end/96750] 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10
  2020-08-23  6:03 [Bug c++/96750] New: 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10 mattreecebentley at gmail dot com
  2020-08-24  8:47 ` [Bug middle-end/96750] " marxin at gcc dot gnu.org
@ 2020-08-24  9:17 ` glisse at gcc dot gnu.org
  2020-08-24  9:38 ` marxin at gcc dot gnu.org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: glisse at gcc dot gnu.org @ 2020-08-24  9:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #1)
> after:
> 1794240.0
> 
> before:
> 1802710.0

That's less than 1% of difference (with "after" better than "before"), not the
10% regression claimed, maybe there is another relevant commit?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug middle-end/96750] 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10
  2020-08-23  6:03 [Bug c++/96750] New: 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10 mattreecebentley at gmail dot com
  2020-08-24  8:47 ` [Bug middle-end/96750] " marxin at gcc dot gnu.org
  2020-08-24  9:17 ` glisse at gcc dot gnu.org
@ 2020-08-24  9:38 ` marxin at gcc dot gnu.org
  2020-08-24 23:21 ` mattreecebentley at gmail dot com
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-08-24  9:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Marc Glisse from comment #2)
> (In reply to Martin Liška from comment #1)
> > after:
> > 1794240.0
> > 
> > before:
> > 1802710.0
> 
> That's less than 1% of difference (with "after" better than "before"), not
> the 10% regression claimed, maybe there is another relevant commit?

Sorry, I copied bad numbers:

after:
1806140.0

before:
1705630.0

which is ~6% regression.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug middle-end/96750] 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10
  2020-08-23  6:03 [Bug c++/96750] New: 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10 mattreecebentley at gmail dot com
                   ` (2 preceding siblings ...)
  2020-08-24  9:38 ` marxin at gcc dot gnu.org
@ 2020-08-24 23:21 ` mattreecebentley at gmail dot com
  2020-09-27 23:34 ` mattreecebentley at gmail dot com
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mattreecebentley at gmail dot com @ 2020-08-24 23:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Matt Bentley <mattreecebentley at gmail dot com> ---
(In reply to Marc Glisse from comment #2)
> (In reply to Martin Liška from comment #1)
> > after:
> > 1794240.0
> > 
> > before:
> > 1802710.0
> 
> That's less than 1% of difference (with "after" better than "before"), not
> the 10% regression claimed, maybe there is another relevant commit?

See the .ods spreadsheet in the zip for my results with same code.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug middle-end/96750] 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10
  2020-08-23  6:03 [Bug c++/96750] New: 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10 mattreecebentley at gmail dot com
                   ` (3 preceding siblings ...)
  2020-08-24 23:21 ` mattreecebentley at gmail dot com
@ 2020-09-27 23:34 ` mattreecebentley at gmail dot com
  2020-09-27 23:35 ` mattreecebentley at gmail dot com
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mattreecebentley at gmail dot com @ 2020-09-27 23:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Matt Bentley <mattreecebentley at gmail dot com> ---
If anyone out there is interested in working on this, 
I found the smallest change possible to create the same performance as GCC8- 
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 exists
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 instances
of this branch statement, even though they won't be called by the benchmark
code in a C++11-compliant compiler.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug middle-end/96750] 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10
  2020-08-23  6:03 [Bug c++/96750] New: 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10 mattreecebentley at gmail dot com
                   ` (4 preceding siblings ...)
  2020-09-27 23:34 ` mattreecebentley at gmail dot com
@ 2020-09-27 23:35 ` mattreecebentley at gmail dot com
  2021-12-22 10:41 ` [Bug ipa/96750] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: mattreecebentley at gmail dot com @ 2020-09-27 23:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Matt Bentley <mattreecebentley at gmail dot com> ---
Created attachment 49278
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49278&action=edit
Demonstration of code which doesn't trigger the performance anomaly.

plf_colony_fast.h does not trigger the problem, has one branch eliminated in
each insert/emplace function.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug ipa/96750] [9/10/11/12 Regression] 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10
  2020-08-23  6:03 [Bug c++/96750] New: 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10 mattreecebentley at gmail dot com
                   ` (5 preceding siblings ...)
  2020-09-27 23:35 ` mattreecebentley at gmail dot com
@ 2021-12-22 10:41 ` pinskia at gcc dot gnu.org
  2022-01-21 13:27 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-22 10:41 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |ipa
   Target Milestone|---                         |9.5
            Summary|10-12% performance decrease |[9/10/11/12 Regression]
                   |in benchmark going from     |10-12% performance decrease
                   |GCC8 to GCC9/GCC10          |in benchmark going from
                   |                            |GCC8 to GCC9/GCC10

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug ipa/96750] [9/10/11/12 Regression] 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10
  2020-08-23  6:03 [Bug c++/96750] New: 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10 mattreecebentley at gmail dot com
                   ` (6 preceding siblings ...)
  2021-12-22 10:41 ` [Bug ipa/96750] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
@ 2022-01-21 13:27 ` rguenth at gcc dot gnu.org
  2022-05-27  9:43 ` [Bug ipa/96750] [10/11/12/13 " rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-21 13:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Needs re-evaluation with GCC 11 / 12 and see if it's worth continue to track
this bug.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug ipa/96750] [10/11/12/13 Regression] 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10
  2020-08-23  6:03 [Bug c++/96750] New: 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10 mattreecebentley at gmail dot com
                   ` (7 preceding siblings ...)
  2022-01-21 13:27 ` rguenth at gcc dot gnu.org
@ 2022-05-27  9:43 ` rguenth at gcc dot gnu.org
  2022-06-28 10:41 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.5                         |10.4

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug ipa/96750] [10/11/12/13 Regression] 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10
  2020-08-23  6:03 [Bug c++/96750] New: 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10 mattreecebentley at gmail dot com
                   ` (8 preceding siblings ...)
  2022-05-27  9:43 ` [Bug ipa/96750] [10/11/12/13 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:41 ` jakub at gcc dot gnu.org
  2022-10-19  9:21 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:41 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug ipa/96750] [10/11/12/13 Regression] 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10
  2020-08-23  6:03 [Bug c++/96750] New: 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10 mattreecebentley at gmail dot com
                   ` (9 preceding siblings ...)
  2022-06-28 10:41 ` jakub at gcc dot gnu.org
@ 2022-10-19  9:21 ` rguenth at gcc dot gnu.org
  2022-10-19  9:22 ` rguenth at gcc dot gnu.org
  2023-07-07 10:37 ` [Bug ipa/96750] [11/12/13/14 " rguenth at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-10-19  9:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 53728
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53728&action=edit
unincluded testcase

Runtimes with GCC 10 and GCC 12 are the same for me, but the benchmark
completes very quickly.

The attached is unincluded compiling with GCC 7 up to trunk for me.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug ipa/96750] [10/11/12/13 Regression] 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10
  2020-08-23  6:03 [Bug c++/96750] New: 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10 mattreecebentley at gmail dot com
                   ` (10 preceding siblings ...)
  2022-10-19  9:21 ` rguenth at gcc dot gnu.org
@ 2022-10-19  9:22 ` rguenth at gcc dot gnu.org
  2023-07-07 10:37 ` [Bug ipa/96750] [11/12/13/14 " rguenth at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-10-19  9:22 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |9.5.0
      Known to work|                            |7.5.0
           Priority|P3                          |P2

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug ipa/96750] [11/12/13/14 Regression] 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10
  2020-08-23  6:03 [Bug c++/96750] New: 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10 mattreecebentley at gmail dot com
                   ` (11 preceding siblings ...)
  2022-10-19  9:22 ` rguenth at gcc dot gnu.org
@ 2023-07-07 10:37 ` rguenth at gcc dot gnu.org
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:37 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |11.5

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-07-07 10:37 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-23  6:03 [Bug c++/96750] New: 10-12% performance decrease in benchmark going from GCC8 to GCC9/GCC10 mattreecebentley at gmail dot com
2020-08-24  8:47 ` [Bug middle-end/96750] " marxin at gcc dot gnu.org
2020-08-24  9:17 ` glisse at gcc dot gnu.org
2020-08-24  9:38 ` marxin at gcc dot gnu.org
2020-08-24 23:21 ` mattreecebentley at gmail dot com
2020-09-27 23:34 ` mattreecebentley at gmail dot com
2020-09-27 23:35 ` mattreecebentley at gmail dot com
2021-12-22 10:41 ` [Bug ipa/96750] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
2022-01-21 13:27 ` rguenth at gcc dot gnu.org
2022-05-27  9:43 ` [Bug ipa/96750] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:41 ` jakub at gcc dot gnu.org
2022-10-19  9:21 ` rguenth at gcc dot gnu.org
2022-10-19  9:22 ` rguenth at gcc dot gnu.org
2023-07-07 10:37 ` [Bug ipa/96750] [11/12/13/14 " rguenth at gcc dot gnu.org

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).