unique ownership + unlimited safe generational references

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Wed Mar 30 12:39:40 UTC 2022


On Wednesday, 30 March 2022 at 11:23:37 UTC, Nick Treleaven wrote:
> On Wednesday, 30 March 2022 at 07:02:16 UTC, Ola Fosheim 
> Grøstad wrote:
>> How does this work with multithreaded shared references?
>
> Vale doesn't allow sharing mutable data across threads. But if 
> the assumption that most programs alias data (copying a 
> pointer) more often than they access the data is correct, it 
> seems thread-safe generational references would still be faster 
> (at least naive RC vs naive GR). The cost of mutual-exclusion 
> would be paid on any dereference check but there would be no 
> cost on aliasing. (Also multiple dereferences of the same data 
> may only need one check in some cases).

You would need a lock on the object, so it is far worse than ARC?



More information about the Digitalmars-d mailing list