On the performance of building D programs

Martin Nowak code at dawg.eu
Sun Apr 7 10:00:56 PDT 2013


On 04/05/2013 12:18 PM, Andrej Mitrovic wrote:
> On 4/5/13, Vladimir Panteleev <vladimir at thecybershadow.net> wrote:
>> it must run dmd with -v -o-, and read its verbose output.
>
> IIRC xfbuild used to work around this by both reading the verbose
> output and simultaneously building. In other words it used 'dmd -deps'
> without the -o- switch. There's a function called compileAndTrackDeps
> which did this, but the entire codebase was very hacky which has lead
> me to abandon the port.
>
> Note that using pipes instead of File I/O to read the verbose output
> of DMD can speed up the entire building process (the new std.process
> comes in handy for this).
>

It would be good to use IPC instead of an a priori -rb -rx argument list.
The idea is that whenever dmd imports a module it ask rdmd (or another 
driver) whether this module should be compiled. The driver could then 
check it's cache for an existing module-object to decide this.
The driver cannot decide this a priori because it's dependency 
information is outdated. It could only heuristically list available 
packages/modules.

1.
driver has no knowledge about foo.bar's dependencies:
dmd -c foo/bar -rb -rxstd.*
----
module foo.bar;

import std.stdio, foo.baz;

// ...
----

2.
driver assumes that foo.bar depends on foo.baz and has a cached obj for 
foo.baz:
dmd -c foo/bar -rb -rxstd.* -rxfoo.baz
----
module foo.bar;

import std.stdio, something.else;

// ...
----



More information about the Digitalmars-d mailing list