www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Win32 executable size. Why 76kb for nothing?

reply Christoph Kobe <christoph kobenetz.de> writes:
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>
Nov 27 2007
next sibling parent Bill Baxter <dnewsgroup billbaxter.com> writes:
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
Nov 27 2007
prev sibling parent reply Hoenir <mrmocool gmx.de> writes:
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.
Nov 27 2007
parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
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
Nov 27 2007
next sibling parent Tomas Lindquist Olsen <tomas famolsen.dk> writes:
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
Nov 27 2007
prev sibling parent "Saaa" <empty needmail.com> writes:
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 
Nov 27 2007