Adding ccache-like output caching to dmd

Petar Petar
Tue Dec 29 17:41:49 UTC 2020


On Tuesday, 29 December 2020 at 12:49:45 UTC, Stefan Koch wrote:
> 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?
>
> The issue is that because of string imports you don't know the 
> full set of files you are depending on.
> which means any change can cause any file to be required.

If we pass the complete set of files (instead of using relying on 
[string] import paths, which not very precise), this definitely 
doable.

Sure, the developer "experience" would be a bit more clumsy, but 
not a big deal either - a wrapper tool could first compile your 
code with `dmd -i -makedeps` [1] and then save the currently 
known set of files and then the incremental compilation would use 
it.

[1]: coming soon: https://github.com/dlang/dmd/pull/12049


More information about the Digitalmars-d mailing list