public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* A user question (was: Re: Faster compilation speed)
@ 2002-08-13 10:34 Marco Morandini
  2002-08-13 10:47 ` Marco Morandini
  2002-08-13 14:29 ` Mike Stump
  0 siblings, 2 replies; 7+ messages in thread
From: Marco Morandini @ 2002-08-13 10:34 UTC (permalink / raw)
  To: gcc

I'm a simple user, so
please forgive me if
I'm asking something obvious.

With Version 1 of the code below the compile time at -O2
is approx a quadratic function of the number of call to pippo(a);
With Version 2 of the code the compile time is approx a linear
function of N.
Is this reasonable? On a 650MHz PIII with 512 Mb of memory
I get the following timings for Version 1:

N     seconds
1000  1.1
10000 16
20000 49
30000 92
40000 186

After that, with 50000 lines of code,
g++ eats all the memory, and goes to swap.

gcc -v
Reading specs from 
/home2/marco/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs
Configured with: ../configure --enable-threads 
--enable-languages=c,c++,f77 --prefix=/home2/marco/local
Thread model: posix
gcc version 3.1

Thanks, and apologize again if this is only noise.

Marco


Version 1
-------------------
class A{
private:
	double c;
public:
	virtual ~A();
};
void dummy(const A&a);
int main(void) {
	A a;
	pippo(a);
           .
           .
    //repeat this line N times
           .
           .
        pippo(a);
        return 0;
}

-------------------

Version 2
-------------------
void dummy(const double&a);
int main(void) {
	double a;
	pippo(a);
           .
           .
    //repeat this line N times
           .
           .
        pippo(a);
        return 0;
}

-------------------


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

end of thread, other threads:[~2002-08-14  4:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-13 10:34 A user question (was: Re: Faster compilation speed) Marco Morandini
2002-08-13 10:47 ` Marco Morandini
2002-08-13 14:29 ` Mike Stump
2002-08-13 17:06   ` PATCH: " Mike Stump
2002-08-13 19:53     ` Richard Henderson
2002-08-14  4:10     ` Michael Matz
2002-08-14  4:42       ` Michael Matz

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