Starting D with a project in mind.

Adam D. Ruppe destructionator at gmail.com
Mon Oct 14 15:03:37 PDT 2013


On Monday, 14 October 2013 at 20:59:25 UTC, Andrew wrote:
> So now I compile Hello World and I get a 2MB executable !

gdc makes kinda large executables... but with my gdc cross 
compiler for arm, the hello world is 360 KB after stripping, but 
I used printf instead of writefln. phobos is pretty bad about its 
dependencies - use writef() and it pulls 20 modules. But even so 
2MB is 5x bigger than it should be...

> My current C code has an embedded web server, json libraries 
> and mongodb client and it's 80kb - what can I expect for the 
> same thing in D ?

D's size cost is mostly up-front - hello world bears the brunt of 
the size and increases after that are small (since the hello 
world already includes most that functionality due to the web of 
dependencies!).

I'd estimate your size to be between 500 KB and 2.5 MB once you 
get all your functionality in. You *can* go much smaller if you 
don't touch phobos at all, writing your D with just C libraries. 
Then it'll be probably around 400 KB like my hello world test - 
still the size of grabbing druntime, but you don't get the phobos 
functions.


More information about the Digitalmars-d-learn mailing list