A few numbers on allocation in dmd

NilsLankila NilsLankila at gmx.us
Thu Jul 9 08:12:20 UTC 2020


On Wednesday, 1 July 2020 at 08:38:13 UTC, kinke wrote:
> On Wednesday, 1 July 2020 at 08:15:12 UTC, NilsLankila wrote:
>> There's already a micro optim for AliasDeclaration, see 
>> https://github.com/dlang/dmd/pull/11354. It should cut the use 
>> by 25% (so the number for AliasDecl *only*), minus the problem 
>> of allocations blocks, so maybe more 10% to 20% IRL.
>
> For 64-bit, the size of a Declaration instance is 200 bytes 
> (2.092 frontend), for AliasDeclaration 232 bytes, and with your 
> change, down to 224 bytes, so the correct number is more like 
> -3.5%. Thx for doing it anyway.
>
> Another thing to keep in mind is that all new'd allocations are 
> padded to a multiple of 16-bytes, see 
> https://github.com/dlang/dmd/blob/d97a908d35c8e6c22571688f12138862ef089337/src/dmd/root/rmem.d#L176 (for the GC/-lowmem too, which has a bigger overhead).

Yeah you're right, I've realized later that I forgot the size of 
the inherited members.


More information about the Digitalmars-d mailing list