Program size, linking matter, and static this()

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Dec 16 15:16:55 PST 2011


On 12/16/11 5:08 PM, Sean Kelly wrote:
> On Dec 16, 2011, at 1:38 PM, Trass3r wrote:
>
>> A related issue is phobos being an intermodule dependency monster.
>> A simple hello world pulls in almost 30 modules!
>
> This was one of the major motivations for separating druntime from
> phobos.  The last thing anyone wants is for something in runtime to
> print to the console and end up pulling in 80% of the standard
> library as a result.

Well, right now druntime itself may have become the interdependency knot 
it once wanted to shun :o).

Commenting out all static cdtors from druntime only reduced the code 
size from 218KB to 200KB for a do-nothing program, so most of druntime 
is compulsively linked and loaded. I think we can improve things a bit 
there.


Andrei


More information about the Digitalmars-d mailing list