A user question (was: Re: Faster compilation speed)
Marco Morandini
morandini@aero.polimi.it
Tue Aug 13 10:34:00 GMT 2002
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;
}
-------------------
More information about the Gcc
mailing list