What can be done to reduce executable size?
Jonathan M Davis
jmdavisProg at gmx.com
Thu Dec 15 23:12:12 PST 2011
On Thursday, December 15, 2011 21:40:57 Andrei Alexandrescu wrote:
> On 12/10/11 9:39 AM, Bane wrote:
> > Short term and long term suggestions ? Anything we can do ? I heard it
> > is some problem with linking dead code?
> >
> >
> >
> > import std.stdio;
> > int main(){
> > writefln("Hello Bloat!");
> > return 0;
> > }
> >
> > dmd -release -O hello.d
> >
> > On Windows:
> > v1.071 = 339 Kb
> > v2.056 = 1017 Kb
> >
> > It looks very ugly and might distract some people.
>
> In fact there was a low-hanging fruit, and I'm sure there are some more.
> This diff reduces the size of hello, world (compiled with -O -release
> -inline and after strip) from 700KB to 220 KB:
>
> https://github.com/D-Programming-Language/phobos/commit/b7f42ec925fb1d64564d
> 48ea419e201bfc65ed53
>
> Right now an executable starts at around 218KB, which includes druntime
> (gc, type info, the works). Importing std.stdio and using writeln() only
> adds a couple of KBs.
Simply making it so that std.file is only imported in std.stdio with
version(unittest) cut off _that_ much?
- Jonathan M Davis
More information about the Digitalmars-d
mailing list