Data-Flow (Escape) Analysis to Aid in Avoiding GC

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Feb 13 00:21:52 PST 2015


When reading/parsing data from disk often try to write code such 
as

     foreach (const line; File(filePath).byLine)
     {
         auto s = line.splitter(" ")

         const x = s.front.to!uint; s.popFront;
         const y = s.front.to!double; s.popFront;
         ...
     }

In response to all the discussions regarding performance problems 
related to the GC I wonder if there are plans to implement 
data-flow analysis in DMD that can detect that the calls to 
s.front in the example above doesn't need to use the GC. This 
because their references aren't used outside of the foreach scope 
(Escape Analysis).


More information about the Digitalmars-d-learn mailing list