Escaping the Tyranny of the GC: std.rcstring, first blood

"Nordlöw" via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 20 08:54:42 PDT 2014


On Saturday, 20 September 2014 at 15:21:18 UTC, Nordlöw wrote:
> for RCString? I'm guessing there are two cases here;

I'm guessing

     size_t toHash() const @trusted pure nothrow
     {
         import core.internal.hash : hashOf;
         if (isSmall)
         {
             return this.small.hashOf;
         }
         else
         {
             return this.large[].hashOf;
         }
     }

Will

     this.large[].hashOf

do unneccessary GC-allocations? -vgc says nothing.

I'm compiling as

     dmd -vcolumns -debug -g -gs -vgc -unittest -wi -main 
rcstring.d -o rcstring.out


More information about the Digitalmars-d mailing list