why simple hello world binary is ~700KB
Anders F Björklund
afb at algonet.se
Fri Oct 5 01:47:30 PDT 2007
Sean Kelly wrote:
> Bedros Hanounik wrote:
>> Ok, I tried dmd 2.0 with the same code and got 271KB binary out of it.
>> still huge compared to 6.5KB generated by gcc.
>
> About the smallest "hello world" binary you'll get from a recent version
> of D is 100k. Prior to 1.0, it was possible to get a 70k "hello world"
> program. In every case however, cstdlib is statically linked to the app.
s/cstdlib/dstdlib/
Last time I tested, D program was right inbetween the C and C++ programs
(assuming that static libstdc++ library was used, to make things "fair")
So while it was 10x the size of C, it was still half the size of C++...
Even more interesting, the Java version was 10x smaller* than C even :-)
And if you want a *really* small hello world, then /bin/sh is good too.
--anders
* not counting the JRE, that is. it was 100x slower to start, though...
More information about the Digitalmars-d
mailing list