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

"Nordlöw" via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 20 11:01:41 PDT 2014


On Saturday, 20 September 2014 at 17:06:48 UTC, Andrei
Alexandrescu wrote:
> Why not just "return this.asSlice.hashOf;"?

Good idea :)

I'll use that instead.

>> Will
>>
>>     this.large[].hashOf
>>
>> do unneccessary GC-allocations? -vgc says nothing.

Ok, great! A couple of followup questions.

How big overhead is an RC compared to a non-RC GC-free string
variant?

Perhaps it would be nice to add a template parameter in RCXString
that makes the RC-optional?

If I want a *non*-RC GC-free variant of string/wstring/dstring
what's the best way to define them?

Would Array!char, Array!wchar, Array!dchar, be suitable
solutions? Of course these wouldn't utilize SSO. I'm asking
because Array is RandomAccess but string/wstring is not
byCodePoint.


More information about the Digitalmars-d mailing list