DIP80: phobos additions

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 9 14:46:14 PDT 2015


On 6/9/15 1:53 PM, Steven Schveighoffer wrote:
> On 6/9/15 2:59 PM, Andrei Alexandrescu wrote:
>> On 6/9/15 11:42 AM, Dennis Ritchie wrote:
>>> "And finally `std.bigint` offers good (but not outstanding)
>>> performance."
>>
>> BigInt should use reference counting. Its current approach to allocating
>> new memory for everything is a liability. Could someone file a report
>> for this please. -- Andrei
>
> Slightly OT, but this reminds me.
>
> RefCounted is not viable when using the GC, because any references on
> the heap may race against stack-based references.

How do you mean that?

> Can we make RefCounted use atomicInc and atomicDec? It will hurt
> performance a bit, but the current state is not good.
>
> I spoke with Erik about this, as he was planning on using RefCounted,
> but didn't know about the hairy issues with the GC.
>
> If we get to a point where we can have a thread-local GC, we can remove
> the implementation detail of using atomic operations when possible.

The obvious solution that comes to mind is adding a Flag!"interlocked". 
-- Andrei



More information about the Digitalmars-d mailing list