This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/8805: [3.2/3.3 regression] compile time regression with many member variables
- From: "Ronny Krashinsky" <ronny at mit dot edu>
- To: <bangerth at dealii dot org>, <gcc-bugs at gcc dot gnu dot org>, <gcc-prs at gcc dot gnu dot org>, <nobody at gcc dot gnu dot org>, <ronny at mit dot edu>, <gcc-gnats at gcc dot gnu dot org>
- Date: Thu, 12 Dec 2002 16:12:35 -0500
- Subject: Re: c++/8805: [3.2/3.3 regression] compile time regression with many member variables
- References: <20021210230147.13953.qmail@sources.redhat.com>
Thank you for the response.
Based on your example, I did some more investigation and determined that the
problem seems to be due to the interaction between member objects with
destructors and C++ exception handling. I've come to this conclusion because
the non-linear increase in compile time does not occur when I compile with
"-fno-exceptions". This makes some amount of sense because C++ states that if
an exception occurs in the middle of initializing the members
in an object's constructor, then the destructor is called for all the members
that have already been constructed. This is an n^2 sort of thing, so it could
be why the compile times were scaling non-linearly with the number of members.
So, it seems like this is probably not a bug, but it would be great if gcc were
better at dealing with code like this. And, I think that it can still be
considered a regression since gcc 2.95 is so much faster.
I don't have write access to the problem report database, so I have not updated
the report.
Thanks,
Ronny
----- Original Message -----
From: <bangerth@dealii.org>
To: <gcc-bugs@gcc.gnu.org>; <gcc-prs@gcc.gnu.org>; <nobody@gcc.gnu.org>;
<ronny@mit.edu>
Sent: Tuesday, December 10, 2002 6:01 PM
Subject: Re: c++/8805: [3.2/3.3 regression] compile time regression with many
member variables
| Old Synopsis: very long (non-linear) compile times for an object with many
vector<int> members, possibly due to template instantiation
| New Synopsis: [3.2/3.3 regression] compile time regression with many member
variables
|
| State-Changed-From-To: open->analyzed
| State-Changed-By: bangerth
| State-Changed-When: Tue Dec 10 15:01:46 2002
| State-Changed-Why:
| Confirmed. A simpler testcase using only (nearly) empty
| classes (but made non-POD) is attached. Compile times can be
| made very large by removing the comment signs of a larger
| part of the block of member variables. Here are some timings:
|
| N=500: gcc2.95: 1s gcc3.3: 5s
| N=1000: gcc2.95: 4s gcc3.3: 20s
|
| So I see a relatively good N**2 behavior, but the
| constant is significantly worse than for 2.95, so I
| rate this a regression. gcc3.2 is somewhere in between,
| about 3 times slower than 2.95, but 25 per cent faster
| than 3.3CVS.
|
| One can play interesting games with this testcase: if
| I _reduce_ the complexity by replacing this code:
| -----
| struct vector { ~vector(); };
| struct C { C();
| vector x; };
|
| struct A {
| A();
|
| typedef C T;
| //...
| ------
|
| by
|
| ----
| struct vector { ~vector(); };
| struct C { C();
| vector x; };
|
| struct A {
| A();
|
| typedef vector T;
| ---
| (i.e. bypassing the C-class), then the compile times
| _increase_ by a factor of 2 to 3. I would really be
| interested in hearing an explanation of this phenomenon!
|
|
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=88
05
|