public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tony Bryant <brd@paradise.net.nz>
To: gcc@gcc.gnu.org
Subject: Slow/Swappy C++ compilation
Date: Sun, 13 Oct 2002 02:27:00 -0000	[thread overview]
Message-ID: <200210131418.28386.brd@paradise.net.nz> (raw)

I've got a relatively small C++ application here that has one global variable 
of an "Everything" class.

My main.cc file is:

//-------------
#include "everything.h"
static TProgramBase Everything;
//-------------

with "everything.h" itself including everything else needed for the definition 
of TEverything (which is uses templates quite heavily)

This compiles fast (<3 secs), and gcc uses less than 5Mb of RAM doing so

If I change this to:

//-------------
#include "everything.h"
class TProgramExtended
{
public:
	TProgramBase EverythingButTheGirl;
};
static TProgramExtended Everything;
//--------------

This compiles as fast and with the same low memory footprint too.

However:

//-------------
#include "everything.h"
class TProgramExtended : public TProgramBase
{
public:
	TProgramExtended();
};
//---------------

this takes over 160Mb of RAM to compile! About 15 seconds if it doesn't start 
swapping.

That's 160Mb to compile a unit without any code emitted!

If you are wondering TProgramBase's constructor is NOT defined as inline.

BTW I'm running gcc 3.1 for sh-elf on RH7.3, -O level has no effect on this 
problem.

What is going on here?

What diagnostics could I usefully run?


             reply	other threads:[~2002-10-13  1:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-13  2:27 Tony Bryant [this message]
2002-10-13 12:14 ` Fergus Henderson
2002-10-14  0:11 ` Tony Bryant
2002-10-14  3:54   ` Zack Weinberg

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=200210131418.28386.brd@paradise.net.nz \
    --to=brd@paradise.net.nz \
    --cc=gcc@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).