This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: g++ compile-time regression
On Wed, Feb 28, 2001 at 12:36:59PM -0300, Alexandre Oliva wrote:
> On Feb 28, 2001, Carlo Wood <carlo@alinoe.com> wrote:
>
> > 3.1 is ten times slower than 2.95.1 for a 'hello world' program :).
>
> Bear in mind that 2.95.* doesn't have template (i.e.,
> Standard-compliant) iostreams.
I understand, which is why I posted this here and not to bugs *grin*
(and I put in that smiley).
Nevertheless, it is a concern to me.
A more realistic example is:
~/c++/libcw/src/libcwd/testsuite>time g++-2.95.1 -DHAVE_CONFIG_H -DCWDEBUG -Ilibcwd.tst -I- -I../include -I./../include -g -pipe -Wall -Woverloaded-virtual -Wundef -Wpointer-arith -Winline -Wwrite-strings -Werror -c libcwd.tst/basic.cc -o tst_basic.o
real 0m0.876s
user 0m0.810s
sys 0m0.060s
~/c++/libcw/src/libcwd/testsuite>time g++-3.1 -DHAVE_CONFIG_H -DCWDEBUG -Ilibcwd.tst -I- -I../include -I./../include -g -pipe -Wall -Woverloaded-virtual -Wundef -Wpointer-arith -Winline -Wwrite-strings -Werror -c libcwd.tst/basic.cc -o tst_basic.o
real 0m2.772s
user 0m2.690s
sys 0m0.080s
The work that the compiler does for the template heavy standard header files
is for templates with very frequently used template parameters and are in 99.9%
of the cases the same. Nevertheless, the compiler does it again and again for
*every* compilation unit. A large project with 100 seperate source files needs
to get this work done 100 times, resulting in 200 seconds of duplicated work.
[ Example: compilation of my libcwd project takes:
real 0m16.798s
user 0m14.000s
sys 0m2.750s
with g++-2.95.1
and
real 0m37.400s
user 0m34.440s
sys 0m2.850s
with g++-3.0 (it doesn't compile with 3.1, I'll file a bug report later).
]
What is needed is a template database with frequently used templates that the
compiler can re-use, if only during the compilation run of one 'make' - but
there is no reason not to make this database more global imho (compare it with
the cache of a webbrowser).
--
Carlo Wood <carlo@alinoe.com>