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

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon Sep 15 07:49:30 PDT 2014


On 9/15/14, 2:53 AM, Robert burner Schadek wrote:
> On Monday, 15 September 2014 at 02:26:19 UTC, Andrei Alexandrescu wrote:
>>
>> The road there is long, but it starts with the proverbial first step.
>> As it were, I have a rough draft of a almost-drop-in replacement of
>> string (aka immutable(char)[]). Destroy with maximum prejudice:
>>
>> http://dpaste.dzfl.pl/817283c163f5
>>
>
> I haven't found a single lock, is single threading by design or is
> thread-safety on your todo?

Currently shared strings are not addressed.

> Could you transfer this into phobos and make it work with the functions
> in std.string, it would be a shame if they wouldn't work out of the box
> when this gets merged. I haven't seen anything that should prevent using
> the functions of std.string except isSomeString but that should be no
> problem to fix.

Good idea.

> This is sort of personal to me as most of my PR are in
> std.string and I sort of aspire to become the LT for std.string ;-)

Oooh, nice!

> I would assume RCString should be faster than string, so could you
> provide a benchmark of the two.

Good idea. It likely won't be faster for the most part (unless it uses 
realloc and realloc is a lot faster than GC.realloc). Designs based on 
RCString will, however, have a tighter memory footprint.


Andrei



More information about the Digitalmars-d mailing list