public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95305] New: Same code takes ~1/10 time to compile under clang++.
@ 2020-05-24 13:33 gcc-bugs at hussar dot me.uk
  2020-05-24 13:34 ` [Bug c++/95305] " gcc-bugs at hussar dot me.uk
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: gcc-bugs at hussar dot me.uk @ 2020-05-24 13:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95305
           Summary: Same code takes ~1/10 time to compile under clang++.
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc-bugs at hussar dot me.uk
  Target Milestone: ---

Created attachment 48590
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48590&action=edit
Time taken to compile same code.

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

* [Bug c++/95305] Same code takes ~1/10 time to compile under clang++.
  2020-05-24 13:33 [Bug c++/95305] New: Same code takes ~1/10 time to compile under clang++ gcc-bugs at hussar dot me.uk
@ 2020-05-24 13:34 ` gcc-bugs at hussar dot me.uk
  2020-05-24 13:53 ` gcc-bugs at hussar dot me.uk
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: gcc-bugs at hussar dot me.uk @ 2020-05-24 13:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jason <gcc-bugs at hussar dot me.uk> ---
Created attachment 48591
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48591&action=edit
Bar-graph of time taken to compile same code.

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

* [Bug c++/95305] Same code takes ~1/10 time to compile under clang++.
  2020-05-24 13:33 [Bug c++/95305] New: Same code takes ~1/10 time to compile under clang++ gcc-bugs at hussar dot me.uk
  2020-05-24 13:34 ` [Bug c++/95305] " gcc-bugs at hussar dot me.uk
@ 2020-05-24 13:53 ` gcc-bugs at hussar dot me.uk
  2020-05-25  7:30 ` [Bug c++/95305] Same code takes ~1/4 to 1/7th the " rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: gcc-bugs at hussar dot me.uk @ 2020-05-24 13:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jason <gcc-bugs at hussar dot me.uk> ---
Overview:
=========
This performance difference appears to affect many versions of g++: my testing
indicates since g++ v7.3.0. The performance difference appears to be a 4-7x
difference in the time taken to compile the example code. I have presented this
a number of times and on a number of occasions I have had reports of similar
differences, so this may not be unique to me.

Steps to create:
================
1. Download source tarball from libjmmcg.sf.net or checkout the repo.
2. In the expanded source directory create the directory "build".
3. "cd build" then "cmake .. -DBUILD_TYPE=Release -DBUILD_CHANGELOG=Off
-DJMMCG_PERFORMANCE_TESTS=On"
4. "cd release/isimud/tests/"
5. Run "time make -j3 test_mit_exchanges_performance".

Details:
========
- The code is heavily templated, with a lot of template meta-programming. I
believe that the ~2x increase in time taken to build the code between g++
v8.1.0 & v8.2.0 & the clang versions is more related to a move from using
"boost::mpl::vector" to varadic templates. I hypothesise that this code-change
triggered different paths in the compiler that caused the increase.
- All tests were carried out on the same physical hardware, a rather aged dual
processor AMD Opteron 4180 with 32Gb or RAM running Gentoo/Linux. The computer
was quiescent for the duration of each test.
- Qualitatively, a number of other of my test cases appear to show this
compilation-time difference. (Most likely due to the shared code.)

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

* [Bug c++/95305] Same code takes ~1/4 to 1/7th the time to compile under clang++.
  2020-05-24 13:33 [Bug c++/95305] New: Same code takes ~1/10 time to compile under clang++ gcc-bugs at hussar dot me.uk
  2020-05-24 13:34 ` [Bug c++/95305] " gcc-bugs at hussar dot me.uk
  2020-05-24 13:53 ` gcc-bugs at hussar dot me.uk
@ 2020-05-25  7:30 ` rguenth at gcc dot gnu.org
  2020-05-26  9:47 ` gcc-bugs at hussar dot me.uk
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-05-25  7:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |compile-time-hog
   Last reconfirmed|                            |2020-05-25
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |WAITING

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Can you attach a "representativ" (maybe the worst?) compilation unit in
preprocessed form?

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

* [Bug c++/95305] Same code takes ~1/4 to 1/7th the time to compile under clang++.
  2020-05-24 13:33 [Bug c++/95305] New: Same code takes ~1/10 time to compile under clang++ gcc-bugs at hussar dot me.uk
                   ` (2 preceding siblings ...)
  2020-05-25  7:30 ` [Bug c++/95305] Same code takes ~1/4 to 1/7th the " rguenth at gcc dot gnu.org
@ 2020-05-26  9:47 ` gcc-bugs at hussar dot me.uk
  2020-05-26  9:48 ` gcc-bugs at hussar dot me.uk
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: gcc-bugs at hussar dot me.uk @ 2020-05-26  9:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jason <gcc-bugs at hussar dot me.uk> ---
(In reply to Richard Biener from comment #3)
> Can you attach a "representativ" (maybe the worst?) compilation unit in
> preprocessed form?

Compressed, the preprocessed translation unit in question is just too large to
upload, but the compressed file may be downloaded from
"http://research.ma.cx/mit_exchanges_performance.cpp.o.lzma".

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

* [Bug c++/95305] Same code takes ~1/4 to 1/7th the time to compile under clang++.
  2020-05-24 13:33 [Bug c++/95305] New: Same code takes ~1/10 time to compile under clang++ gcc-bugs at hussar dot me.uk
                   ` (3 preceding siblings ...)
  2020-05-26  9:47 ` gcc-bugs at hussar dot me.uk
@ 2020-05-26  9:48 ` gcc-bugs at hussar dot me.uk
  2020-05-27 21:26 ` redi at gcc dot gnu.org
  2020-05-27 22:03 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: gcc-bugs at hussar dot me.uk @ 2020-05-26  9:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jason <gcc-bugs at hussar dot me.uk> ---
(In reply to Jason from comment #4)
> (In reply to Richard Biener from comment #3)
> > Can you attach a "representativ" (maybe the worst?) compilation unit in
> > preprocessed form?
> 
> Compressed, the preprocessed translation unit in question is just too large
> to upload, but the compressed file may be downloaded from
> "http://research.ma.cx/mit_exchanges_performance.cpp.o.lzma".

When extracted it is about 15Mb.

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

* [Bug c++/95305] Same code takes ~1/4 to 1/7th the time to compile under clang++.
  2020-05-24 13:33 [Bug c++/95305] New: Same code takes ~1/10 time to compile under clang++ gcc-bugs at hussar dot me.uk
                   ` (4 preceding siblings ...)
  2020-05-26  9:48 ` gcc-bugs at hussar dot me.uk
@ 2020-05-27 21:26 ` redi at gcc dot gnu.org
  2020-05-27 22:03 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-27 21:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Created attachment 48621
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48621&action=edit
preprocessed source

Compile with -std=gnu++17

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

* [Bug c++/95305] Same code takes ~1/4 to 1/7th the time to compile under clang++.
  2020-05-24 13:33 [Bug c++/95305] New: Same code takes ~1/10 time to compile under clang++ gcc-bugs at hussar dot me.uk
                   ` (5 preceding siblings ...)
  2020-05-27 21:26 ` redi at gcc dot gnu.org
@ 2020-05-27 22:03 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-27 22:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Using gcc-10 branch and -std=gnu++17 -ftime-report I get a number of errors due
to x86 intrinsics and this time report:



Time variable                                   usr           sys          wall
              GGC
 phase setup                        :   0.02 (  0%)   0.01 (  0%)   0.04 (  0%)
   1493 kB (  0%)
 phase parsing                      :  55.90 ( 17%)   6.28 ( 11%)  62.34 ( 16%)
3134206 kB ( 37%)
 phase lang. deferred               : 147.04 ( 44%)  49.59 ( 88%) 196.86 ( 50%)
5176483 kB ( 61%)
 phase opt and generate             : 131.22 ( 39%)   0.18 (  0%) 131.62 ( 34%)
 238463 kB (  3%)
 |name lookup                       :  36.29 ( 11%)   6.32 ( 11%)  42.96 ( 11%)
  96935 kB (  1%)
 |overload resolution               :  87.37 ( 26%)  24.47 ( 44%) 113.41 ( 29%)
4175293 kB ( 49%)
 garbage collection                 :   5.30 (  2%)   0.02 (  0%)   5.32 (  1%)
      0 kB (  0%)
 dump files                         :   0.06 (  0%)   0.03 (  0%)   0.10 (  0%)
      0 kB (  0%)
 callgraph construction             : 130.86 ( 39%)   0.13 (  0%) 131.12 ( 34%)
 159684 kB (  2%)
 ipa inheritance graph              :   0.01 (  0%)   0.00 (  0%)   0.01 (  0%)
     47 kB (  0%)
 preprocessing                      :   1.17 (  0%)   0.69 (  1%)   1.55 (  0%)
  72580 kB (  1%)
 parser (global)                    :   1.65 (  0%)   0.69 (  1%)   2.85 (  1%)
 210199 kB (  2%)
 parser struct body                 :   1.04 (  0%)   0.22 (  0%)   1.08 (  0%)
  97627 kB (  1%)
 parser enumerator list             :   0.18 (  0%)   0.04 (  0%)   0.23 (  0%)
  77970 kB (  1%)
 parser function body               :   0.32 (  0%)   0.12 (  0%)   0.48 (  0%)
  18259 kB (  0%)
 parser inl. func. body             :   1.17 (  0%)   0.18 (  0%)   1.27 (  0%)
  56413 kB (  1%)
 parser inl. meth. body             :   1.78 (  1%)   0.51 (  1%)   2.38 (  1%)
 146304 kB (  2%)
 template instantiation             : 162.32 ( 49%)  43.83 ( 78%) 206.04 ( 53%)
7604626 kB ( 89%)
 constant expression evaluation     :  27.83 (  8%)   9.51 ( 17%)  37.73 ( 10%)
  26669 kB (  0%)
 tree gimplify                      :   0.17 (  0%)   0.02 (  0%)   0.19 (  0%)
  48688 kB (  1%)
 tree eh                            :   0.03 (  0%)   0.00 (  0%)   0.04 (  0%)
   5016 kB (  0%)
 tree CFG construction              :   0.03 (  0%)   0.00 (  0%)   0.09 (  0%)
  20079 kB (  0%)
 tree CFG cleanup                   :   0.04 (  0%)   0.00 (  0%)   0.03 (  0%)
     14 kB (  0%)
 dominance computation              :   0.01 (  0%)   0.00 (  0%)   0.02 (  0%)
      0 kB (  0%)
 varconst                           :   0.11 (  0%)   0.04 (  0%)   0.17 (  0%)
     38 kB (  0%)
 loop init                          :   0.01 (  0%)   0.00 (  0%)   0.02 (  0%)
   4933 kB (  0%)
 symout                             :   0.07 (  0%)   0.02 (  0%)   0.10 (  0%)
      0 kB (  0%)
 TOTAL                              : 334.18         56.09        390.89       
8550662 kB

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

end of thread, other threads:[~2020-05-27 22:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-24 13:33 [Bug c++/95305] New: Same code takes ~1/10 time to compile under clang++ gcc-bugs at hussar dot me.uk
2020-05-24 13:34 ` [Bug c++/95305] " gcc-bugs at hussar dot me.uk
2020-05-24 13:53 ` gcc-bugs at hussar dot me.uk
2020-05-25  7:30 ` [Bug c++/95305] Same code takes ~1/4 to 1/7th the " rguenth at gcc dot gnu.org
2020-05-26  9:47 ` gcc-bugs at hussar dot me.uk
2020-05-26  9:48 ` gcc-bugs at hussar dot me.uk
2020-05-27 21:26 ` redi at gcc dot gnu.org
2020-05-27 22:03 ` redi 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).