boost crowd.

Marco Leise Marco.Leise at gmx.de
Mon Nov 28 18:12:03 PST 2011


Am 28.11.2011, 14:42 Uhr, schrieb Maxim Fomin <maxim at maxim-fomin.ru>:

> 2011/11/28 Marco Leise <Marco.Leise at gmx.de>:
>> Am 28.11.2011, 11:02 Uhr, schrieb Jude <10equals2 at gmail.com>:
>>
>>>> I tried to write a lib and a project, which used that lib
>>>> separately, but came to conclusion that the best choice it to pull
>>>> lib code to project one. And it is not a biggest problem, because
>>>> dmd produces 700 kb executable for hello word program.
>>>
>>> what..?
>>>
>>> I don't know how you are managing to get 700kb for hello world...
>>> mine clocks in a 283.7kb with dmd with no optmizations, and holy crap
>>> 1.6MB for same file with gdmd.
>>>
>>> WTF is going on there I wonder...?
>>
>> *drum roll*
>>
>> 148,2 kB (dmd 2.054, Linux)
>>
>> *tadaa*
>>
>> - 8< - - - - - - - - - - - - - - - - - - -
>> import std.stdio;
>>
>> void main() {
>>        writeln("Hello, world!");
>> }
>> - 8< - - - - - - - - - - - - - - - - - - -
>>
>
> ------
> import std.stdio;
>
> class dummy
> {
> 	this() { writeln("ctor");}
> 	~this() { writeln("dtor"); }
> }
>
> void main()
> {
> 	auto dm = new dummy();
> }
> -------
>
> dmd main.d -o
> 377,9 kb
> It is not 700 as i told, but yesterday i upgraded to 2.056. But
> definitely i saw that it produces 700 kb elf for a small program.
> Anyway, is 400 kb for dummy program too much?

Be aware that classes and structs have .init blocks that can grow huge if  
you declare large static arrays in them. So the source code may be small,  
but the executable bloats. And every template instantiation adds to it as  
well. I think even just using writeln with different parameters all over  
the place adds up, but thats a vague guess.


More information about the Digitalmars-d mailing list