Smart pointers instead of GC?

Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com> Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com>
Tue Feb 4 13:37:20 PST 2014


On Tuesday, 4 February 2014 at 21:02:37 UTC, deadalnix wrote:
> Core can share a cache line in read mode, but can't in write 
> mode.

Why not? Level 3 is shared, but it has a latency of 30-40 cycles 
or so.

> That mean that updating the reference count will cause 
> contention on the cache line (core will have to fight for the 
> cache line ownership).

If they access it simultaneously and it stays in the local caches.

> That is why immutability + GC is so efficient in a highly 
> concurrent system, and ref counting would ruin that.

If you blindly use ARC rather than sane RC. There is no reason to 
up the ref count if the data structure is "owned" while 
processing it. Which is a good reason to avoid ARC and use 
regular RC. If you know that the entire graph has a 1+ count, you 
don't need to do any ref counting while processing it.


More information about the Digitalmars-d mailing list