[phobos] Why did the exe size just increase by 170K since dmd2.051?

Jonathan M Davis jmdavisProg at gmx.com
Mon Feb 7 15:35:09 PST 2011


On Monday, February 07, 2011 15:16:46 Walter Bright wrote:
> Jonathan M Davis wrote:
> > On Monday, February 07, 2011 14:30:18 Walter Bright wrote:
> >> compile with the -map option.
> >> 
> >> tl,dr: everything in Phobos/Druntime references everything else.
> > 
> > Doing stuff like removing eponymous templates from the binary (since all
> > you relaly need is the result, not the template instantiation) would
> > likely help.
> 
> I'm sorry to bang the drum on this, but the very first step is to
> generate the .map file using the -map switch. Then you *know* what is
> taking up space in the executable. Otherwise, you're doing no better
> than guessing at why Bob's credit card bill is high without ever looking
> at his visa statement.

True. But it _is_ a known issue that various detrius from the compilation 
process gets left in the resulting binary. How much space it takes up is an open 
question. It could be that it's a very small portion in any binary, but it _is_ 
something that should be fixed if we're looking to trim down the size of 
binaries.

Personally, while I don't particularly like the idea of useless stuff ending up 
in a binary, I don't much care about the increasing executable size. Your 
typical D executable could be 5mb for all I care. My first reaction to people 
complaining about the size of D binaries is that they're being overly picky. But 
maybe at least some of them have use cases where it actually matters. I sure 
don't though. A small binary might be nice, but it's far from critical in any 
situation that I typically deal with.

But yes. If you want to really know why the binaries are getting larger, looking 
at the results of -map is the kind of thing that you'd really need to do.

- Jonathan M Davis


More information about the phobos mailing list