Uncalled functions in hello world

Stefan Koch uplink.coder at googlemail.com
Wed Apr 8 14:10:48 UTC 2020


On Wednesday, 8 April 2020 at 14:08:23 UTC, Basile B. wrote:
> On Wednesday, 8 April 2020 at 13:57:47 UTC, Stefan Koch wrote:
>> The current phobos hello world
>> import std.stdio;
>> void main() { "Hello World".writeln; }
>> generates a list of 36 functions which are generated and 
>> emitted but not called, and therefore presumably only used at 
>> compile time
>>
>> Those are:
>>
>> [...]
>>
>> So you can see that there is something to be won even in the 
>> most trivial examples if we have facilities to disable codegen 
>> for functions which are only used at compiletime.
>
> Are you sure that this is not also caused by bad speculative 
> template instantiation ?
> In case I'd use the wrong wording, I mean "some function 
> templates that are wrongly determined to be emitted ".

That might very well be the cause.
Most of those would however benefit from being annotated 
ctfe-only.


More information about the Digitalmars-d mailing list