www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Binary size with dmd 2.042

reply bearophile <bearophileHUGS lycos.com> writes:
Using dmd 2.042 if I compile on Windows this program:

import std.stdio;
void main() {}

The binary is 195_612 bytes. And its asm is 38_574 bytes, it contains tons of
functions like:
_D6object28__T16AssociativeArrayTAyaTiZ16AssociativeArray4keysMFNdZAAya


While if I compile this one-line program:

void main() {}


The binary is now bigger, 242_716 bytes, but its asm is much smaller, just
1_007 bytes, it contains just the _Dmain, moduleinfo and little more.


I don't understand.

Bye,
bearophile
Apr 04 2010
next sibling parent Walter Bright <newshound1 digitalmars.com> writes:
bearophile wrote:
 I don't understand.
If you want to find out what is linked in, compile with -map and look at the linker .map file. There's nothing mysterious about it.
Apr 04 2010
prev sibling parent reply anonymous troll <troll technolo.gy> writes:
bearophile Wrote:

 Using dmd 2.042 if I compile on Windows this program:
 
 import std.stdio;
 void main() {}
 
 The binary is 195_612 bytes. And its asm is 38_574 bytes, it contains tons of
functions like:
 _D6object28__T16AssociativeArrayTAyaTiZ16AssociativeArray4keysMFNdZAAya
 
 
 While if I compile this one-line program:
 
 void main() {}
 
 
 The binary is now bigger, 242_716 bytes, but its asm is much smaller, just
1_007 bytes, it contains just the _Dmain, moduleinfo and little more.
 
 
 I don't understand.
Does the binary size matter these days? The 1..2 TB drives bring the best gigabyte / dollar ratio. You can store 10 million such programs on a single drive.
Apr 05 2010
parent Robert Clipsham <robert octarineparrot.com> writes:
On 06/04/10 00:44, anonymous troll wrote:
 Does the binary size matter these days? The 1..2 TB drives bring the best
gigabyte / dollar ratio. You can store 10 million such programs on a single
drive.
I believe the issue wasn't with binary size, but rather with why including std.stdio miraculously made the binary lose weight, when you'd expect it to gain more.
Apr 05 2010