A few numbers on allocation in dmd

NilsLankila NilsLankila at gmx.us
Thu Jul 9 08:09:59 UTC 2020


On Wednesday, 1 July 2020 at 08:26:05 UTC, NilsLankila wrote:
> On Tuesday, 30 June 2020 at 01:54:54 UTC, rikki cattermole [...]
> idPool is already used but only to guarantee identifiers 
> uniqueness (i.e reject dups). I think that a second idpool 
> could be used, this one to share those who has not be be 
> unique, just like dparse's StringCache/internString()

I've ~~spent~~ wasted some time yesterday evening to work on 
puting an intern system directly in the two Identifier __ctor 
that allocate, and this is not worth. only 300Kb won. but the 
overhead of the new table waste more. Actually most of the 
identifiers are already interned.

Then, there's no more easy possible gain in the AST. Basically 
for Expression and Statement derived nodes there's nothing 
anymore.

Walter has made a good optimisation for Type (-40Mo used for 
dparse).

I've made 3 minors ones (-3Mo for dparse).

Andrei made one for template instance but unfortunately it hasn't 
saved a full block of memory. What you have to understand, if you 
wish to propose something is that to reduce usage a class must 
have it's size div 16 taking one less, eg 32 to 17 has not impact 
but 32 to 15 does.

Honestly I think this will be hard to do better **without** 
serious work and deep changes.

Anyway for now compiling dparse using ~master and on x86_64 takes 
904Mo VS 950Mo previously.
That'd be nice if 3 or 4 micro optims would be found, so that it 
goes below 900 Megs, symbolically.


More information about the Digitalmars-d mailing list