This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
gcc-3.0 release. Compilation time
- To: gcc-bugs at gcc dot gnu dot org
- Subject: gcc-3.0 release. Compilation time
- From: Laurent Michel <ldm at mediaone dot net>
- Date: Sun, 29 Jul 2001 12:35:17 -0400
Hi!
I've been using g++ for quite some time now. The last version I used was 2.95.4 on a Debian woody system:
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs
gcc version 2.95.4 20010319 (Debian prerelease)
I downloaded the official gcc-3.0 tarball and build it locally (configure;make bootstrap)
Here is the output of g++ -v
thorgal /home/ldm [22] -> /usr/local/bin/g++ -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.0/specs
Configured with: ../srcdir/configure
Thread model: single
gcc version 3.0
I then proceeded to rebuild my system (about 82000 lines of C++) with 3.0.
I noticed a major slowdown in compile time: Compiling in debug mode with 2.95.4 gives this running time:
g++ -c -Wall -fPIC -g -Woverloaded-virtual (this is the list of options I use)
make[1]: Leaving directory `/home/ldm/work/Comet/plugin'
209.240u 11.700s 3:47.82 96.9% 0+0k 0+0io 352128pf+0w
3 minutes 47 seconds:
With gcc 3.0 however:
make[1]: Leaving directory `/home/ldm/work/Comet/plugin'
575.940u 17.370s 10:09.86 97.2% 0+0k 0+0io 386450pf+0w
More than 10 minutes!
This is on a 1.1Ghz AMD Tbird machine. I am more than willing to wait a long time when compiling in optimized mode, but in debug, it should be pretty fast.
In an attempt to see what was going on, I tried to compile a very dumb C++ fragment that includes the iostream lib: Here is the source code and compile times with the two compilers:
#include <iostream>
#include <fstream>
class Foo {
std::ifstream _file;
public:
Foo() {}
~Foo() {}
};
int main()
{
Foo f();
return 0;
}
thorgal /home/ldm [37] -> time g++ -c -Wall -fPIC gizmo.C
0.110u 0.000s 0:00.11 100.0% 0+0k 0+0io 959pf+0w
thorgal /home/ldm [38] -> time /usr/local/bin/g++ -c -Wall -fPIC gizmo.C
1.070u 0.010s 0:01.08 100.0% 0+0k 0+0io 1173pf+0w
Clearly, the gcc-3.0 is about 10 times slower on this very simple file. So my questions are
1) What is going on ?
2) Is there a way to speed up gcc with option during the configure/build of gcc itself?
3) If not, is this a known 'problem' ? It is fixed in a newer gcc version ?
4) Generally speaking, is there a way to recover faster compilation ?
Thanks for your input on this!
PS/ both the 2.95.4 and 3.0 are installed on the same disk (local disk) and run on the same machine, so there are no network latencies or anything of this type. System is running a 2.4.6 kernel:
thorgal /home/ldm [39] -> uname -a
Linux thorgal 2.4.6 #6 Sun Jul 8 17:13:55 EDT 2001 i686 unknown
with 256Mb of RAM.
thorgal /home/ldm [40] -> cat /proc/meminfo
total: used: free: shared: buffers: cached:
Mem: 261644288 241299456 20344832 0 9666560 154796032
Swap: 370094080 0 370094080
MemTotal: 255512 kB
MemFree: 19868 kB
MemShared: 0 kB
Buffers: 9440 kB
Cached: 151168 kB
Active: 29180 kB
Inact_dirty: 131052 kB
Inact_clean: 376 kB
Inact_target: 0 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 255512 kB
LowFree: 19868 kB
SwapTotal: 361420 kB
SwapFree: 361420 kB
--
Laurent