Program size, linking matter, and static this()

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Dec 16 13:45:43 PST 2011


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.

Once we solve the static constructor issue, function-level linking 
should take care of pulling only the minimum needed.

One interesting fact is that a lot of issues that I tended to take 
non-critically ("templates cause bloat", "intermodule dependencies cause 
bloat", "static linking creates large programs") looked a whole lot 
differently when I looked closer at causes and effects.


Andrei


More information about the Digitalmars-d mailing list