A few numbers on allocation in dmd

Simen Kjærås simen.kjaras at gmail.com
Wed Jul 1 06:16:42 UTC 2020


On Tuesday, 30 June 2020 at 01:58:42 UTC, Stefan Koch wrote:
> On Tuesday, 30 June 2020 at 01:54:54 UTC, rikki cattermole 
> wrote:
>> On 30/06/2020 1:18 PM, Andrei Alexandrescu wrote:
>>> * Any work that reduces the number of TypeIdentifier, 
>>> TemplateInstance, etc. objects in the first place would help 
>>> quite a bit.
>>
>> One strategy that is used with identifiers in dmd is to use a 
>> table lookup of strings to them. By making them unique, it 
>> makes them faster overall.
>>
>> If we could strip out the SLOC out of the TypeIdentifier 
>> class, this strategy could be used for it.
>
> I would guess TypeIdentifiers being excessively is one of the 
> side effects of massive template instantiation.
>
> Templates are a crutch when used for meta programming.
> It's time we start walking on two strong legs.

Looking at the numbers, it's interesting how closely the numbers 
for TemplateInstance, AliasDeclaration and ScopeDsymbol match, 
with TypeIdentifier being very close to 2x that.

Could it be there's some template(s) on the form template 
Foo(T...) { alias Foo = Foo!(...) }? :p

--
   Simen


More information about the Digitalmars-d mailing list