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

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 20 08:30:55 PDT 2014


On 9/20/14, 12:42 AM, Dicebot wrote:
> On Friday, 19 September 2014 at 15:09:41 UTC, Andrei Alexandrescu wrote:
>>> as amount of write operations gets out of control. Every single attempt
>>> to do something clever with shared CoW strings in C++ I have met was a
>>> total failure.
>>
>> What were the issues?
>
> Usually it went that way:
>
> 1) Get basic implementation, become shocked how slow it is because of
> redundant reference increments/decrements and thread safety
> 2) Add speed-up hacks to avoid reference count amending when considered
> unnecessary
> 3) Get hit by a snowball of synchronization / double-free issues and
> abandon the idea completely after months of debugging.

I understand. RC strings will work just fine. Compared to interlocked 
approaches we're looking at a 5x improvement in RC speed for the most 
part because we can dispense with most interlocking. -- Andrei



More information about the Digitalmars-d mailing list