Program size, linking matter, and static this()

Timon Gehr timon.gehr at gmx.ch
Fri Dec 16 14:01:12 PST 2011


On 12/16/2011 10:53 PM, Trass3r wrote:
> Am 16.12.2011, 22:45 Uhr, schrieb Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org>:
>
>> On 12/16/11 3:38 PM, Trass3r wrote:
>>> A related issue is phobos being an intermodule dependency monster.
>>> A simple hello world pulls in almost 30 modules!
>>> And std.stdio is supposed to be just a simple wrapper around C FILE.
>>
>> In fact it doesn't (after yesterday's commit). The std code in hello,
>> world is a minuscule 3KB. The rest of 218KB is druntime.
>
> Yep, the 30 modules is a measure I took before that commit.
>
>> Once we solve the static constructor issue, function-level linking
>> should take care of pulling only the minimum needed.
>
> Also by pulling in I just meant the imports.
> But the planned lazy semantic analysis should improve the situation.

I think it is already lazy?
---
module a;

void foo(){
     imanundefinedsymbolandcauseacompileerror();
}
---
---
module b;
import a;

void main(){
     foo();
}
---

$ dmd -c b # compiles fine



More information about the Digitalmars-d mailing list