gcc 4.0 C++ Compilation Speed

KDE sources now blacklist gcc 4.0.0 because it miscompiles KDE but that shouldn't be
a reason to do no compilation benchmarks, or? :-) My test machine was an Athlon XP
2600+ with 512MB and SUSE 9.3's gcc 3.3.5. The other gcc versions were pure gcc.

My first test was to compile Qt 3.3.4:

             -O0     -O2
gcc 3.3.5   23m40   31m38
gcc 3.4.3   22m47   28m45
gcc 4.0.0   13m16   19m23

Next I compiled kdelibs/HEAD with --enable-final and unsermake -j 2:

             -O0     -O2
gcc 3.3.5   14m44   27m28
gcc 3.4.3   14m49   27m03
gcc 4.0.0    9m54   23m30

Finally the usual development case, same as above without --enable-final:

gcc 3.3.5   32m56
gcc 3.4.3   32m49
gcc 4.0.0   15m15

I really like gcc 4.0's -O0 compilation speed improvement. :-) After the Subversion
switch (latest rumor this weekend) I will certainly start to use gcc 4.0.1 or a
recent snapshot. Let us hope that gcc 4.1 keeps the optimization promises for
generated code the same way.

Emerging question: When will we see "unsertool" replacing the slow-going libtool?


wow those are some interesting results, cause seems like most of the complaints I hear against gcc is that each release it takes longer and longer to compile stuff, but obviously thats not the case here

By studale at Fri, 04/29/2005 - 11:09

Have you tried any benchmarks of runtime performance of the different compilers? If GCC 4.0 really makes faster binaries, that's more important to the end-user.

By Nick Matteo at Fri, 04/29/2005 - 23:26

No, I didn't try. gcc runtime performance is not annoying me and guess most people neither. Likely it's faster by some percent but not the same magnitude. :-) Application start performance and binary size whereas are better with gcc 4.0 because it allows KDE to prevent unnecessary exported symbols.

By at Sat, 04/30/2005 - 11:55

The prospect of 50% less time waiting for my compiles to finish while developing is too good to be true! I have high hopes now and Arch has gcc 4 in testing...

By mxcl at Sat, 04/30/2005 - 01:16

> KDE sources now blacklist gcc 4.0.0 because it miscompiles KDE...
Is this KDEs or GCCs failure?

By Mathias Panzenböck at Sat, 04/30/2005 - 13:03

How could it be KDE's failure?

By at Sat, 04/30/2005 - 16:00

Conceivably the code could use deprecated/now-obsoleted features.

By Nick Matteo at Tue, 05/03/2005 - 21:20

Then the compilation would have to fail and not silently produce broken code.

By at Tue, 05/03/2005 - 21:39

Indeed, if that's not the case then it's certainly GCC's fault.

By Nick Matteo at Tue, 05/03/2005 - 21:49