"The std.stdio package imports most the standard library" etc.

Sean Kelly via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 5 16:36:49 PDT 2014


On Monday, 1 September 2014 at 00:19:43 UTC, Adam D. Ruppe wrote:
> On Monday, 1 September 2014 at 00:10:25 UTC, Abe wrote:
>> Is this roughly the same on all relevant platforms for DMD?
>
> Yeah. If you used printf instead of writeln, the size gets down 
> to about 250K (on my linux anyway), which can then be stripped 
> down to 160K, showing that the rest of the size comes from 
> pulling in a lot of standard library code.
>
> The rest of that 160 K is the druntime library, stuff like 
> thread support, memory management, etc. that is always present.
>
> It is possible to strip that out too and make really tiny 
> executables (I've gone down to under 3KB before playing with 
> this, as have other people working in the embedded space), but 
> then you don't get any of the library and it is easier said 
> than done.

It used to be that a "hello world" D app using printf ran about
65K.  At some point, a lot of bloat appeared in the form of a
ModuleInfo object for each imported module, and these objects
themselves grew in size for reasons I can't recall.  That bloat
has since been trimmed down, but I believe there's still work to
be done there.


More information about the Digitalmars-d mailing list