Thread overview
Win32 executable size. Why 76kb for nothing?
Nov 27, 2007
Christoph Kobe
Nov 27, 2007
Bill Baxter
Nov 27, 2007
Hoenir
Nov 27, 2007
Bill Baxter
Nov 28, 2007
Saaa
November 27, 2007
Hi,
I'm new to D and I wonder what I can do to decrease the size of my executable files.
When I compile

void main()
{
}

dmd creates a 76kb .exe file. Why? What can I do to decrease theses file-sizes?

-- 
Christoph Kobe <christoph@kobenetz.de>
November 27, 2007
Christoph Kobe wrote:
> Hi,
> I'm new to D and I wonder what I can do to decrease the size of my executable files.
> When I compile
> 
> void main()
> {
> }
> 
> dmd creates a 76kb .exe file. Why? What can I do to decrease theses file-sizes?
> 

This should be in a D FAQ somehwere.

Here's a previous thread about it:

http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=55902

--bb
November 27, 2007
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.
November 27, 2007
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
November 27, 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
November 28, 2007
Yes, I'd love to have the demoscene use D.
Those are some talented programmers from what I've seen.

> 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