Object.factory() and exe file size bloat

Mike via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 20 23:00:42 PDT 2015


On Friday, 21 August 2015 at 05:35:21 UTC, Walter Bright wrote:
> On 8/20/2015 10:24 PM, BBasile wrote:
>> Other alternatives would be a pragma or an attribute to 
>> disable TypeInfo
>> generation.
>
> Interestingly, my idea would not disable TypeInfo generation. 
> Instead, the TypeInfo would be generated into a COMDAT section. 
> Then, only if it is referenced is it linked in.

Disabling TypeInfo forces one to compromise on slicing, postblit, 
and potentially others useful features, so finding a way to keep 
TypeInfo, yet remove the dead code is much less of a blunt 
instrument, and very much preferred.

> The ModuleInfo, as it currently is implemented, contains a 
> reference to every class TypeInfo, thus pulling them all in.

Ideally it would be nice to only pull in those ModuleInfo 
instances that are actually needed in the program, and by 
association, only pull in those TypeInfo instances needed by the 
ModuleInfo.  If no ModuleInfo is used, and the associated 
TypeInfo is also not used, then neither is pulled in.

Mike


More information about the Digitalmars-d mailing list