public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Slow/Swappy C++ compilation
@ 2002-10-13  2:27 Tony Bryant
  2002-10-13 12:14 ` Fergus Henderson
  2002-10-14  0:11 ` Tony Bryant
  0 siblings, 2 replies; 4+ messages in thread
From: Tony Bryant @ 2002-10-13  2:27 UTC (permalink / raw)
  To: gcc

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?


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

end of thread, other threads:[~2002-10-14  3:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-13  2:27 Slow/Swappy C++ compilation Tony Bryant
2002-10-13 12:14 ` Fergus Henderson
2002-10-14  0:11 ` Tony Bryant
2002-10-14  3:54   ` Zack Weinberg

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