public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "phil at fsel dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/19445] New: 50 fold compile time increase between gcc-3,4 and gcc-4,0 on included code
Date: Fri, 14 Jan 2005 16:52:00 -0000	[thread overview]
Message-ID: <20050114165235.19445.phil@fsel.com> (raw)

$ 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


             reply	other threads:[~2005-01-14 16:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-14 16:52 phil at fsel dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050114165235.19445.phil@fsel.com \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).