Why C++ compiles slowly

Leandro Lucarella luca at llucax.com.ar
Thu Aug 19 12:16:37 PDT 2010


Walter Bright, el 19 de agosto a las 11:00 me escribiste:
> >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.
> 
> In no case is it worse than C++, and as soon as you import a file
> more than once you're faster.

Is worse in the sense that you have the feeling that is free in D, but
it's not. In C++ you *have* to be careful, otherwise the compiler eats
you. In D, when this starts to be significant, you already have a huge
project.

And again, I agree that it might be a very reasonable trade-off, but
that doesn't mean the problem doesn't exist. That's all. I'm not trying
to convince anyone that C++ is better, I'm just saying in C++ the
problem is obvious while in D is much less visible, and you note it
*only* when your project is big enough and you *need* incremental
compilation.


And I know also that DMD (and every DMD-based D compiler) can generate
.di files. It would be really nice to have a -M option like GCC that
automatically writes Makefile dependencies. But that's another topic.

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
A veces quisiera ser un barco,
para flotar como floto siendo humano,
y no hundirme como me hundo


More information about the Digitalmars-d mailing list