Generated binary size

Johannes Pfau nospam at example.com
Fri Sep 13 05:50:46 PDT 2013


Am Fri, 13 Sep 2013 13:45:58 +0200
schrieb "Dicebot" <public at dicebot.lv>:

> I was experimenting with `--gc-sections` effect on D code (with 
> great results) and have noticed that GDC binaries are much bigger 
> than DMD ones. I do understand that it is not a priority goal 
> right now but still curious, does anyone know what makes such 
> notable (~50%) difference?
> (64-bit OS)
> 
> --------
> import std.stdio, std.algorithm;
> 
> void main()
> {
>      auto arr = [ 1, 2, 3 ];
>      writeln( arr.map!( a => a*2 )() );
> }
> --------
> $ gdc -ofhello-gdc -O3 hello.d
> $ dmd -ofhello-dmd -release -inline -O hello.d
> $ ls -la
> # ...
> -rwxr-xr-x 1 dicebot users  819647 Sep 13 13:38 hello-dmd
> -rwxr-xr-x 1 dicebot users 1386355 Sep 13 13:39 hello-gdc
> -------

It seems like the gdc compiled program has more symbols for some
reason:

----------
nm hello-dmd --defined-only | wc -l
3834
nm hello-gdc --defined-only | wc -l
5451
----------

Here's a "diff" of the defined symbols:
https://gist.github.com/jpf91/6550247


More information about the D.gnu mailing list