Memoization in DMD

"Nordlöw" via Digitalmars-d digitalmars-d at puremagic.com
Sun Jul 6 15:12:42 PDT 2014


On Sunday, 6 July 2014 at 21:38:28 UTC, Walter Bright wrote:

I'm thinking in terms of a caching build system like scons that 
memoize on the object/lib level. As dmd/rdmd kind of realizes a 
simple build system I thought we somewhere could inject 
memoization on the object level and see how large projects would 
have to be to benefit from using memoized compilation of sources 
files to separate objects and then link them.

> I'd turn that around and ask where you are seeing potential 
> savings? Note that you can run obj2asm on the generated object 
> files, please do so and point out where things can be cached.

Alternatively, wouldn't it be possible to instead memoize the 
individual writes to the resulting binary? This memoization could 
preferrably be indexed by some message digest (as is done by 
scons) based on either the dmd parameters and the content of the 
input source files that influences a specific code-gen or perhaps 
even the parts of the asts that were inputs. I realize that these 
dependencies, of course, may be difficult to distinguish from 
each other.

How are these separate writes to the resulting binary split up? 
By generated functions and static data initializations? If so a 
good first test would be to just calculate these digests and 
compare them between two compilations with a minor change between 
them and see how large percentage of them that remain unchanged.

Robert Shadek spoke at DConf 2013 about a "Distributed Caching 
Compiler" he was working on so I thought the idea is not that 
completely irrelevant right? I was mainly curious if the D 
leaders have discussed this further as there are examples of D 
projects, such as DCD, that take more than a 1 minute to build 
(on my laptop).


More information about the Digitalmars-d mailing list