From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2513 invoked by alias); 12 Dec 2002 21:16:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 2499 invoked by uid 71); 12 Dec 2002 21:16:02 -0000 Date: Thu, 12 Dec 2002 13:16:00 -0000 Message-ID: <20021212211602.2498.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: "Ronny Krashinsky" Subject: Re: c++/8805: [3.2/3.3 regression] compile time regression with many member variables Reply-To: "Ronny Krashinsky" X-SW-Source: 2002-12/txt/msg00723.txt.bz2 List-Id: The following reply was made to PR c++/8805; it has been noted by GNATS. From: "Ronny Krashinsky" To: , , , , , Cc: Subject: Re: c++/8805: [3.2/3.3 regression] compile time regression with many member variables Date: Thu, 12 Dec 2002 16:12:35 -0500 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: To: ; ; ; 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 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 |