Re: C++ Frequently Questioned Answers
Hyman Rosen wrote:
Walter Bright wrote:
Even so, a build time of ten minutes is very consequential.
Having a build time of a few seconds can completely transform
how one develops code.
It takes far less most of the time, since I don't do complete
rebuilds very often. Most of the time, as I said, I'm bound by
the speed of the Solaris linker an dthe size of the executable.
I know very well how and why templates slow down compilation,
and this is inherent to how C++ templates work. It is not fixable.
The code that I work on drags in messaging libraries, database
libraries, GUI libraries, math libraries, and lord knows what
else. I don't believe that the templates are particularly a
bottleneck in my compiler.
Linkers often have a lot to do to factor out all the redundant template
instantiations. These instantiations bloat up the object files, then
have to be removed by the linker. Templates are an indirect source of
slowdown in the linker.
If you're using the gnu linker, ld, it's a painfully slow linker anyway
<g>, but it doesn't have to be that way.
P.S. It's a fool's game to guess what the particular bottlenecks in a
compiler are without access to the source and a profiler. But I know
what must happen when templates are instantiated, and that cannot be
waved away. See my reply to David.
----
Walter Bright
Digital Mars C, C++, D programming language compilers
http://www.digitalmars.com
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]