Would you pay for GC?

Elronnd elronnd at elronnd.net
Wed Jan 26 06:20:06 UTC 2022


On Wednesday, 26 January 2022 at 00:03:26 UTC, rikki cattermole 
wrote:
> After reading my book on GC, you're kinda right.

Thanks for the show of confidence :)


> 2) Support a task/fiber aware GC. This will kinda give us a 
> generational GC, without actually being a generational GC.

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.

One java implementation used the high bits of the stack pointer 
as a thread identifier/tls pointer/etc.

I would like to see adaptive nursery size.  Good for 
non-fibre-based web stuff, also e.g. video games.  Imagine: you 
tell the GC every tick/request, and it tunes nursery size to 
99%ile allocation size per frame.  Actual GC is pretty much free 
since all the stuff you allocated over the course of the frame is 
gone.  Then you have all the safety of the full GC approach, and 
nearly all the performance of the manual arena approach (and much 
better than malloc/free).


More information about the Digitalmars-d mailing list