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.