This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: compile time through roof!
- To: hjansen at math dot tudelft dot nl
- Subject: Re: compile time through roof!
- From: "Martin v. Loewis" <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Thu, 10 Jun 1999 10:51:26 +0200
- CC: egcs-bugs at egcs dot cygnus dot com, vanandel at ucar dot edu
- References: <99060317074804.00737@duti7m>
> I wondered if this is something we will have to learn to live with
> if one's wanting to use a sophisticated language such as C++ or is
> this merely a transient state on the part of the egcs development
> process?
Originally, I intended to analyse this in more detail before gcc 2.95
(being interested in CXX myself). However, I won't find the time so
here's a quick response: Yes :-)
C++ compilers will always process source code at a slower speed than C
compilers, primarily because any speed improvements on the C++
compiler will be also applied to the C compiler. Many people don't
consider this as a serious problem, as hardware speed also goes up.
OTOH, compilation *will* speed up over time (so it is a transient
problem), for two reasons: The template processing wasn't tuned for
speed in the past - except when it got unbearably slow (or, in one
case in the recent past, consumed an unreasonable amount of memory).
My guess is that many things are computed
over-and-over-again. Sometimes, this is even a bug - we look up
non-dependent names at instantiation time, whereas a compliant
compiler should do so at definition time.
Also, there will be features to allow developers to write
faster-compilable code, namely exported templates. This feature means
that 'large' templates don't have to appear in the header file. As a
result, a compiler doesn't have to try and parse them. Also, they will
get instantiated only at link time, and then only once for the entire
program.
Nevertheless, I think CXX is a great test case, both for completeness
and compliance of the C++ implementation, as well as for compilation
speed.
Regards,
Martin