Would you pay for GC?

IGotD- nise at nise.com
Fri Jan 28 10:18:32 UTC 2022


On Wednesday, 26 January 2022 at 06:20:06 UTC, Elronnd wrote:
>
> Thread-local gc is a thing.  Good for false sharing too (w/real 
> threads); can move contended objects away from owned ones.  But 
> I see no reason why fibre-local heaps should need to be much 
> different from thread-local heaps.
>

I would like to challenge the idea that thread aware GC would do 
much for performance. Pegging memory to one thread is unusual and 
doesn't often correspond to the reality.

For example a computer game with large amount of vertex data 
where you decide to split up the workload on several threads. You 
don't make a thread local copy of that data but keep the original 
vertex data global and even destination buffer would be global.

What I can think of is a server with one thread per client with 
data that no other reason thread works on. Perhaps there thread 
local GC could be benefitial. My experience is that this thread 
model isn't good programming and servers should instead be 
completely async meaning any thread might handle the next partial 
work.

As I see it thread aware GC doesn't do much for performance but 
complicates it for the programmer.


More information about the Digitalmars-d mailing list