Purity, memoization and parallelization of dmd

Atila Neves atila.neves at gmail.com
Tue Jul 21 11:37:16 UTC 2020


On Monday, 20 July 2020 at 12:58:39 UTC, Petar Kirov [ZombineDev] 
wrote:
> On Monday, 20 July 2020 at 10:39:08 UTC, Atila Neves wrote:
>> [...]
>
> Build system level parallelism usually implies separate 
> compilation

Yes.

> (especially in the C++ world), however, if you're building at 
> package-level granularity parallelism could be quite useful 
> actually.


Yes.

> If you have a package, where many of its modules import each 
> other, module-level separate compilation can be quite 
> inefficient.

Yes.

> For example, if a module has an immutable variable, the result 
> of an expensive CTFE calculation, with separate compilation you 
> would end up repeating the calculation every time this module 
> is imported. With package-level compilation, it would be 
> calculated only once.

Correct. Which is why reggae defaults to building per package.

> I'd also say that build system-level caching is leaves a lot to 
> be desired. At work we use various languages and frameworks 
> where the compiler runs as a daemon process, listening for 
> changes and then only recompiles parts of the program that 
> changed. How big are the parts depends on the compiler 
> implementation - it could be a file granularity, function 
> granularity, or even a statement/expression granularity.

That is my dream for D. If the compiler *is* the build system, 
then sure, parallelise the compiler. Currently, I don't see the 
point of even trying.



More information about the Digitalmars-d mailing list