Program size, linking matter, and static this()
Walter Bright
newshound2 at digitalmars.com
Fri Dec 16 14:55:47 PST 2011
On 12/16/2011 1:45 PM, Andrei Alexandrescu wrote:
> On 12/16/11 3:38 PM, Trass3r wrote:
>> A related issue is phobos being an intermodule dependency monster.
>> A simple hello world pulls in almost 30 modules!
>> And std.stdio is supposed to be just a simple wrapper around C FILE.
>
> In fact it doesn't (after yesterday's commit). The std code in hello, world is a
> minuscule 3KB. The rest of 218KB is druntime.
Another thing is to avoid using classes for things where one does not expect it
to ever be derived from. Use a struct instead, as referencing parts of the
struct implementation will not pull in the whole of it, nor is there a vtbl[] to
pull it all in.
For example, in std.datetime there's "final class Clock". It inherits nothing,
and nothing can be derived from it. The comments for it say it is merely a
namespace. It should be a struct.
More information about the Digitalmars-d
mailing list