What should happen here?

deadalnix deadalnix at gmail.com
Tue Sep 28 16:22:40 UTC 2021


On Tuesday, 28 September 2021 at 06:38:20 UTC, Elronnd wrote:
> On Monday, 27 September 2021 at 22:15:26 UTC, deadalnix wrote:
>> I don't see why storing the GC root needs to be expensive
>
> Because you need to be able to remove the root later.  So it 
> essentially reduces to a hash table.  Wrt contention, 
> concurrent hash table is doable 
> (https://github.com/boundary/high-scale-lib/blob/master/src/main/java/org/cliffc/high_scale_lib/NonBlockingHashMap.java) but would need to be implemented; however I agree with Steven that I don't understand why you would do this when you could just store the pointer on the stack or in a register.

Even then, unless you addRoot like mad, linear search through the 
array is goign to be super fast (in fact, LLVM DenseSet/DenseMap 
do exactly that untill the element count gets too high).


More information about the Digitalmars-d mailing list