Why C++ compiles slowly
Leandro Lucarella
luca at llucax.com.ar
Thu Aug 19 08:13:35 PDT 2010
Andrei Alexandrescu, el 19 de agosto a las 08:50 me escribiste:
> On 08/19/2010 07:48 AM, Eldar Insafutdinov wrote:
> >>I'll be doing a followup on why D compiles fast.
> >
> >I will say the contrary. Compiling medium size projects doesn't matter in either
> >language. But when the size of your project starts getting very big you will have
> >troubles in D because there is no incremental compilation.
>
> I'm a bit confused - how do you define incremental compilation? The
> build system can be easily set up to compile individual D files to
> object files, and the use the linker in a traditional manner.
I think in D you can do the same level of incremental compilation as in
C/C++ but is not as natural. For one, in D is not natural to separate
declarations from definitions, so a file in D tends to be dependent in
*many* *many* other files because of excessive imports, so even when you
can do separate compilation, unless you are *extremely* careful (much
more than in C/C++ I think) you'll end up having to recompile the whole
project even you change just one file because of the dependency madness.
I know you can do separate compilation as in C/C++ writing the
declarations in a different file, or generating/using .di files, but
also you'll probably end up using libraries that don't do that (as
somebody mentioned for C++ + STL) and end up in a dependency madness
anyway. It's just not natural to do so in D, it even encourages not
doing it as one of the main advertised features is you don't have to
separate declarations from definitions.
And I'm not saying that is an easy to solve problem, I'm just saying
that I agree D doesn't scale well in terms of incremental compilations
for big projects, unless you go against D natural way on doing things.
--
Leandro Lucarella (AKA luca) http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Hay manos capaces de fabricar herramientas
con las que se hacen máquinas para hacer ordenadores
que a su vez diseñan máquinas que hacen herramientas
para que las use la mano
More information about the Digitalmars-d
mailing list