January 31, 2005
On Sun, 30 Jan 2005 19:29:56 +0100, Sebastian Beschke <s.beschke@gmx.de> wrote:

> zwang schrieb:
>> Sebastian Beschke wrote:
>>
>>> Hi,
>>>
>>> I'm not sure if this has been brought up before, but anyway:
>>>
>>> I've noticed (in a project currently containing 37 source files) that building everything in one DMD call is much faster than using SCons (which is supposed to speed up building by not rebuilding everything every time). I guess this is because DMD has to repeatedly lex the imported modules.
>>>
>>> I think that a) SCons should be modified to build everything in one DMD call and b) dmd might add some kind of caching of the lexed data between compiler calls.
>>>
>>> Is any of this possible? How do other build tools (such as aap) handle this?
>>>
>>> -Sebastian
>>   Rebuilding everything is /much faster/ than just compiling the changed
>> source?  This sounds really counterintuitive.
>> Why is it so, Walter?
>
> I guess I can already tell you the reason. SCons calls the compiler for every single source file. This means that dmd has to lex the imports once for every file. If I, however, supply all files on the command line at once, dmd can keep the lexed files in memory.
>
> Basically, SCons seems to assume that the cost to compile any single file is a lot higher than the cost of lexing the imports. The reverse seems to be the case.
>
> -Sebastian

We need some kind of precompiled modules, maybe? <g>
February 02, 2005
> I guess I can already tell you the reason. SCons calls the compiler for every single source file. This means that dmd has to lex the imports once for every file. If I, however, supply all files on the command line at once, dmd can keep the lexed files in memory.

Compiling C/C++ with GCC is similar, although probably to a lesser extent. I ran some tests a while ago and found that sending multiple source files in one call to gcc is around 15-20% faster than making separate calls to gcc (http://forum.gbadev.org/viewtopic.php?t=4245 About 3/4 down the first page, and page 2). I can only speculate on the causes, but I assume there's some sort of caching going on.

I've been starting to get a little annoyed lately by various build tools (not just SCons) that have less-than-ideal support for multiple sources in one call to the compiler. (And sometimes the problem isn't just the build tool, but a combination of the build tool and gcc's inability to place object files in the same directory as the matching source when compiling sources from multiple directories at one time.) I'll have to check out A-A-P.


1 2
Next ›   Last »