phobos src level stats

Bruce Carneal bcarneal at gmail.com
Tue Sep 22 21:01:17 UTC 2020


On Tuesday, 22 September 2020 at 20:53:17 UTC, Bruce Carneal 
wrote:
> Below you'll find category line percentages and total line 
> counts for the 20 biggest files in phobos.
>
> The "line" counts following the file names are of the 
> dscanner/libdparse variety rather than the 'wc' variety.
>
> On a 2.4GhZ zen1, libdparse managed all of phobos in a little 
> under 1.5 seconds.  For comparison note that all files were 
> read in a little under 10 milliseconds (from file cache).
>
> I really enjoyed my first interaction with libdparse but I'm 
> guessing that the maintainers there strongly favor 
> clarity/correctness over speed.  One other note, compiling with 
> dub's --combined option cut the execution time of the 
> ldc2/release exe by about 2X.
>

The empty line numbers seem a little high to me.  I may have a 
bug in the code for that:

ulong countEmptyLines(string rawText) @nogc nothrow pure @safe
{
     ulong empties;
     lineLoop: foreach (line; lineSplitter(rawText))
     {
         foreach_reverse (ch; line)
             if (ch != ' ' && ch != '\t')
                 continue lineLoop;
         ++empties;
     }
     return empties;
}



More information about the Digitalmars-d mailing list