public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19445] New: 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code
@ 2005-01-14 16:52 phil at fsel dot com
  2005-01-14 16:53 ` [Bug c++/19445] " phil at fsel dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: phil at fsel dot com @ 2005-01-14 16:52 UTC (permalink / raw)
  To: gcc-bugs

$ time g++-snapshot -O -c list1.ii   

real    0m3.617s
user    0m3.515s
sys     0m0.043s
$ time g++-3.4 -O -c list1.ii

real    0m0.068s
user    0m0.028s
sys     0m0.007s
$ g++-snapshot -v
Using built-in specs.
Configured with: ../src/configure -v --enable-languages=c,c++,java,objc,ada
--prefix=/usr/lib/gcc-snapshot --enable-shared --with-system-zlib --enable-nls
--enable-threads=posix --without-included-gettext --disable-werror
--enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk i486-linux-gnu
Thread model: posix
gcc version 4.0.0 20050110 (experimental)

$ cat list1.ii 
# 1 "list1.cpp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "list1.cpp"
template<class T> class Pointer
{
  typedef Pointer<T> point;
  T *ptr;
public:
  Pointer() : ptr(0) { }
  Pointer(T *x) : ptr(x) { if(ptr) ptr->inc(); }
  ~Pointer() { if(ptr) ptr->dec(); ptr=0; }
  T *operator->() const { return ptr; }
  T &operator*() const { return *ptr; }
  bool null() const { return ptr == 0; }

  void exchange(Pointer &x)
  { T *t = x.ptr; x.ptr = ptr; ptr = t; }
};


class ListNode
{
public:
  mutable int count;
  Pointer<ListNode> next;
  void unhook(Pointer<ListNode> *p)
  {
    while(!(*p).null() && (*p)->count == 1)
    {
      Pointer<ListNode> t;
      t.exchange((*p)->next);
      t.exchange(*p);
    }
  }
public:
  ~ListNode()
  {
    unhook(&next);
  }
  void inc() const
  { ++count; }
  void dec() const
  { if(--count <= 0) delete this; }
public:
  ListNode(const int &d)
    : count(0), next()
  { }
};

void test(ListNode p)
{
  p.unhook(&p.next);
}

-- 
           Summary: 50 fold compile time increase between gcc-3,4 and gcc-
                    4,0 on included code
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: phil at fsel dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i486-linux-gnu
  GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19445


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

* [Bug c++/19445] 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code
  2005-01-14 16:52 [Bug c++/19445] New: 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code phil at fsel dot com
@ 2005-01-14 16:53 ` phil at fsel dot com
  2005-01-14 17:02 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: phil at fsel dot com @ 2005-01-14 16:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From phil at fsel dot com  2005-01-14 16:53 -------
Created an attachment (id=7959)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7959&action=view)
.ii file


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19445


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

* [Bug c++/19445] 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code
  2005-01-14 16:52 [Bug c++/19445] New: 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code phil at fsel dot com
  2005-01-14 16:53 ` [Bug c++/19445] " phil at fsel dot com
@ 2005-01-14 17:02 ` pinskia at gcc dot gnu dot org
  2005-01-14 20:29 ` phil at fsel dot com
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-14 17:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-14 17:02 -------
Can you check with --disable-checking as checking is turned on by default on the mainline of 4.0.0.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19445


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

* [Bug c++/19445] 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code
  2005-01-14 16:52 [Bug c++/19445] New: 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code phil at fsel dot com
  2005-01-14 16:53 ` [Bug c++/19445] " phil at fsel dot com
  2005-01-14 17:02 ` pinskia at gcc dot gnu dot org
@ 2005-01-14 20:29 ` phil at fsel dot com
  2005-01-14 21:20 ` [Bug tree-optimization/19445] " pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: phil at fsel dot com @ 2005-01-14 20:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From phil at fsel dot com  2005-01-14 20:29 -------
Subject: Re:  50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code

On Fri, Jan 14, 2005 at 05:02:48PM -0000, pinskia at gcc dot gnu dot org wrote:
> Can you check with --disable-checking as checking is turned on by
> default on the mainline of 4.0.0.

Not as bad, but still pretty awful:

$ /scribble/phil/gcc/install/bin/g++ -v
Using built-in specs.
Configured with: ../gcc/configure --prefix=/scribble/phil/gcc/install
--disable-checking --enable-languages=c++
Thread model: posix
gcc version 4.0.0 20050114 (experimental)
$ time /scribble/phil/gcc/install/bin/g++ -O -c
list1.cpp

real    0m1.758s
user    0m1.677s
sys     0m0.035s
$ time gcc-3.4 -O -c list1.cpp

real    0m0.101s
user    0m0.069s
sys     0m0.009s

cheers, Phil


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19445


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

* [Bug tree-optimization/19445] 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code
  2005-01-14 16:52 [Bug c++/19445] New: 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code phil at fsel dot com
                   ` (2 preceding siblings ...)
  2005-01-14 20:29 ` phil at fsel dot com
@ 2005-01-14 21:20 ` pinskia at gcc dot gnu dot org
  2005-01-14 21:20 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-14 21:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-14 21:20 -------
If in the source I mark unhook as it does not throw anything, the compile time goes back down to what 
should be.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19445


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

* [Bug tree-optimization/19445] 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code
  2005-01-14 16:52 [Bug c++/19445] New: 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code phil at fsel dot com
                   ` (3 preceding siblings ...)
  2005-01-14 21:20 ` [Bug tree-optimization/19445] " pinskia at gcc dot gnu dot org
@ 2005-01-14 21:20 ` pinskia at gcc dot gnu dot org
  2005-01-14 21:24 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-14 21:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-14 21:20 -------
There are two problems, one we are not decting that unhook will not throw (but that did not happen in 
3.4.0 either) and we are inlining unhook into itself which is what is causing the compile time to go up.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
          Component|c++                         |tree-optimization
     Ever Confirmed|                            |1
           Keywords|                            |compile-time-hog
   Last reconfirmed|0000-00-00 00:00:00         |2005-01-14 21:20:03
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19445


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

* [Bug tree-optimization/19445] 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code
  2005-01-14 16:52 [Bug c++/19445] New: 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code phil at fsel dot com
                   ` (4 preceding siblings ...)
  2005-01-14 21:20 ` pinskia at gcc dot gnu dot org
@ 2005-01-14 21:24 ` pinskia at gcc dot gnu dot org
  2005-01-14 21:50 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-14 21:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-14 21:24 -------
One more thing with -Os the compile time is fine in 4.0.0 because we don't duplicate final blocks.

I am not marking this as a regression because we produce better code with the mainline than 3.4/3.3 
for this case.  Basically the problem can be fixed by making gcc not inline a function into itself or 
making the decting if a function does not throw better.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19445


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

* [Bug tree-optimization/19445] 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code
  2005-01-14 16:52 [Bug c++/19445] New: 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code phil at fsel dot com
                   ` (5 preceding siblings ...)
  2005-01-14 21:24 ` pinskia at gcc dot gnu dot org
@ 2005-01-14 21:50 ` pinskia at gcc dot gnu dot org
  2005-01-14 21:54 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-14 21:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-14 21:50 -------
Here is a short testcase for when we should dect a function throws nothing:
int g(int i);
int h(int i) throw();
inline int f(int i) { h(i);if(i<10)return 1;else return g(i-1) + i;}
inline int g(int i) { return f(i); }
int temp(int i) throw()
{
  return g(i);
}

I will file a new bug about this one.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19445


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

* [Bug tree-optimization/19445] 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code
  2005-01-14 16:52 [Bug c++/19445] New: 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code phil at fsel dot com
                   ` (6 preceding siblings ...)
  2005-01-14 21:50 ` pinskia at gcc dot gnu dot org
@ 2005-01-14 21:54 ` pinskia at gcc dot gnu dot org
  2005-01-14 21:55 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-14 21:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-14 21:54 -------
dect == detect (I was sloppy at writting that).

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19445


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

* [Bug tree-optimization/19445] 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code
  2005-01-14 16:52 [Bug c++/19445] New: 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code phil at fsel dot com
                   ` (7 preceding siblings ...)
  2005-01-14 21:54 ` pinskia at gcc dot gnu dot org
@ 2005-01-14 21:55 ` pinskia at gcc dot gnu dot org
  2005-01-17 11:06 ` phil at fsel dot com
  2005-07-25  4:42 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-14 21:55 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |19452


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19445


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

* [Bug tree-optimization/19445] 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code
  2005-01-14 16:52 [Bug c++/19445] New: 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code phil at fsel dot com
                   ` (8 preceding siblings ...)
  2005-01-14 21:55 ` pinskia at gcc dot gnu dot org
@ 2005-01-17 11:06 ` phil at fsel dot com
  2005-07-25  4:42 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: phil at fsel dot com @ 2005-01-17 11:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From phil at fsel dot com  2005-01-17 11:06 -------
Subject: Re:  50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code

On Fri, Jan 14, 2005 at 09:20:43PM -0000, pinskia at gcc dot gnu dot org wrote:
> If in the source I mark unhook as it does not throw anything, the compile time goes back down to what 
> should be.

Indeed. And I can confirm that the tree-profiling branch doesn't show
the problem on the original source code either.

cheers, Phil


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19445


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

* [Bug tree-optimization/19445] 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code
  2005-01-14 16:52 [Bug c++/19445] New: 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code phil at fsel dot com
                   ` (9 preceding siblings ...)
  2005-01-17 11:06 ` phil at fsel dot com
@ 2005-07-25  4:42 ` pinskia at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-25  4:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-25 04:41 -------
Fixed on the mainline.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.1.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19445


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

end of thread, other threads:[~2005-07-25  4:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-14 16:52 [Bug c++/19445] New: 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code phil at fsel dot com
2005-01-14 16:53 ` [Bug c++/19445] " phil at fsel dot com
2005-01-14 17:02 ` pinskia at gcc dot gnu dot org
2005-01-14 20:29 ` phil at fsel dot com
2005-01-14 21:20 ` [Bug tree-optimization/19445] " pinskia at gcc dot gnu dot org
2005-01-14 21:20 ` pinskia at gcc dot gnu dot org
2005-01-14 21:24 ` pinskia at gcc dot gnu dot org
2005-01-14 21:50 ` pinskia at gcc dot gnu dot org
2005-01-14 21:54 ` pinskia at gcc dot gnu dot org
2005-01-14 21:55 ` pinskia at gcc dot gnu dot org
2005-01-17 11:06 ` phil at fsel dot com
2005-07-25  4:42 ` pinskia at gcc dot gnu dot 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).