Program size, linking matter, and static this()

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Dec 20 06:23:37 PST 2011


On 12/20/11 9:00 AM, Denis Shelomovskij wrote:
> 16.12.2011 21:29, Andrei Alexandrescu пишет:
[snip]
> Really sorry, but it sounds silly for me. It's a minor problem. Does
> anyone really cares about 600 KiB (3.5x) size change in an empty
> program? Yes, he does, but only if there is no other size increases in
> real programs.

In my experience, in a system programming language people do care about 
baseline size for one reason or another. I'd agree the reason is often 
overstated. But I did notice that people take a look at D and use 
"hello, world" size as a proxy for language's overall overhead - 
runtime, handling of linking etc. You may or may not care about the 
conclusions of our investigation, but we and a category of people do 
care for a variety of project sizes and approaches to building them.

> Now dmd have at least _two order of magnitude_ file size increase. I
> posted that problem four months ago at "Building GtkD app on Win32
> results in 111 MiB file mostly from zeroes".
[snip]
> ---
> char arr[1024 * 1024 * 10];
> void main() { }
> ---
[snip]
> If described issues aren't much more significant than "static this()",
> show me where am I wrong, please.

Using BSS is a nice optimization, but not all compilers do it and I know 
for a fact MSVC didn't have it for a long time. That's probably why I 
got used to thinking "poor style" when seeing a large statically-sized 
buffer with static duration.

I'd say both issues deserve to be looked at, and saying one is more 
significant than the other would be difficult.


Andrei


More information about the Digitalmars-d mailing list