Adding ccache-like output caching to dmd

Johan j at j.nl
Tue Dec 29 18:50:12 UTC 2020


On Monday, 28 December 2020 at 23:14:02 UTC, Per Nordlöw wrote:
> Has anyone considered integrating into a `dmd` a ccache-like 
> caching of output files indexed by digests based on
>
> - environment variables,
> - process arguments which, in turn, decide
> - input file contents (including import files detected upon 
> first uncached compile)
> - dmd compiler binary fingerprint
> - ...probably something more I missed
>
> Initial call stores that list alongside content hash and 
> resulting binary(s).
>
> If not, would anyone have any strong objections against adding 
> this?

FWIW, I feel this is much better handled by a build system that 
invokes the compiler, and not by the compiler itself. Handling 
the build environment, input/intermediate/output files 
(timestamps, interdependencies etc.), invoking (or caching) the 
substep tool, ..., are core tasks of a build system tool. Caching 
would add a lot of non-core-task complexity to a compiler.

The specific task of optimization and machine code generation is 
cachable by LDC (see `--cache`), but that is much more limited 
task.

-Johan



More information about the Digitalmars-d mailing list