More memory consumption experiments
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.com
Wed Jul 22 18:05:35 UTC 2020
https://github.com/dlang/dmd/pull/11381#issuecomment-662593270
The projects tested are as varied as dstats, emsi containers, vibed,
mir, and more. They consistently indicate these three places as the
heaviest memory consumers:
* https://github.com/dlang/dmd/blob/master/src/dmd/dtemplate.d#L5895
* https://github.com/dlang/dmd/blob/master/src/dmd/mtype.d#L5344
* https://github.com/dlang/dmd/blob/master/src/dmd/dtemplate.d#L2969
Any opportunity to refactor code so as to put those allocations back in
the pool is likely to have great impact. I'm thinking:
* Are parts of some objects reused? Then factor the reused parts in
immutable members, and use a pointer to the variable parts.
* Lazy copying? syntaxCopy() copies the object, but maybe it's often the
case there wasn't a real need for a copy. Maybe a copy-on-write strategy
could hel
* Of course, reducing the size of TemplateInstance and TypeIdentifier
would be of great help.
More information about the Digitalmars-d
mailing list