Discussion on Go and D

Rainer Schuetze r.sagitario at gmx.de
Sat Apr 7 07:38:24 PDT 2012



On 4/7/2012 12:44 AM, Manu wrote:
> On 7 April 2012 01:08, Rainer Schuetze <r.sagitario at gmx.de
> <mailto:r.sagitario at gmx.de>> wrote:
>
>     I don't think there are many places in the code where these hints
>     might apply. Are there known ways of hunting down false references?
>
>     Still, my main concern are the slow collections that stall the
>     application when a decent amount of memory is used. Removing false
>     pointers won't change that, just make it happen a little later.
>
>
> An obvious best-practise is to allocate in fewer-larger blocks. Ie, more
> compounds and aggregates where possible.
> I also expect you are doing a lot of string processing. Using D strings
> directly? I presume you have a stack-string class? Put as many working
> strings on the stack as possible...

There isn't a lot of string processing involved: tokens take a slice on 
the original text, and nodes of the AST seldomly save more than the 
identifier which just the same slice. So the full text always remains in 
memory, but this is only small part of the actual footprint, the AST is 
a lot bigger.

The nodes have child and parent references, so you keep the whole AST 
once there is a false pointer to any node. I could try breaking up this 
dependencies when I think the AST is no longer used, but that brings me 
back to manual memory management and thread synchronization (parsing 
uses std.parallelism).


More information about the Digitalmars-d mailing list