Why C++ compiles slowly
Eric Poggel
dnewsgroup2 at yage3d.net
Thu Aug 19 11:57:04 PDT 2010
On 8/19/2010 11:13 AM, Leandro Lucarella wrote:
> 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.
>
>
I link my game engine (20kloc) with derelict, which is much larger. On
my 5 year old laptop, it takes about 3-4 seconds to compile the engine,
importing the non di'd derelict headers, and linking with the derelict
lib. If I compile the whole lot, it takes about 30 seconds.
Just wanted to share some real-world stats.
More information about the Digitalmars-d
mailing list