Win32 executable size. Why 76kb for nothing?
Tomas Lindquist Olsen
tomas at famolsen.dk
Tue Nov 27 15:48:39 PST 2007
Bill Baxter wrote:
> Hoenir wrote:
>> I'm wondering why everyone complains about the exe size.
>> You have to consider things like the garbage collector and the
>> statically linked standard runtime library when judging it.
>>
>> Just use exe compressors like upx to reduce the size to some degree.
>
> I don't really know either but I have thought it would be cool if D
> could be used for writing demoscene demos
> (http://www.scheib.net/play/demos/what/index.html). It would be a nice
> way to show off D's speed and to-the-metal leanness. But an entire demo
> with all its sound and visuals is usually 64KB. 76kb for main(){} is a
> non-starter there.
>
> --bb
From my work with LLVMDC, ModuleInfo seems to be biggest killer here. Because all moduleinfo
must be available through the static method:
ModuleInfo[] ModuleInfo.module()
they have to be concatenated together at linktime into a constant array. This makes it a lot
harder for the linker to strip out the unused parts of phobos.
As an example, my testcases used to be around 7kb stripped, now they are more like 55kb.
Consistently :/ I'm not really sure what can be done about this, as D relies on ModuleInfo to
do static ctor/dtors as well as unittests (though these are not the problem here as they would
not be included in the released binary).
- Tomas
More information about the Digitalmars-d-learn
mailing list