DMD internal: appendToModuleMember performance

David Nadlinger via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 22 23:50:23 PDT 2016


On Friday, 22 April 2016 at 23:49:22 UTC, Walter Bright wrote:
> BTW, this looks like a particularly bad piece of engineering. 
> The trouble is, it saves an index to the member, then does a 
> bunch of semantic processing, then deletes what is on that 
> index. But what if the members[] in the meantime shifts around?
>
> There is an assert for that case, so it at least won't cause 
> corruption, but it looks bad.

IIRC I was involved in this somehow. It has been some time, but I 
think the deal is that it only does so when all the other members 
that might have been added in the meantime have also been 
removed. I suppose it seemed like a good idea to save that local 
information locally instead of increasing the size of 
TemplateInstance by a pointer, of which there might be a 
bajillion instances in a typical "modern" D program.

  — David


More information about the Digitalmars-d mailing list