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

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