← Back to context

Comment by zozbot234

6 hours ago

> but still, tracing GCs have much better performance on server workloads

Good performance with traditional tracing GC's involves a lot of memory overhead. Golang improves on this quite a bit with its concurrent GC, and maybe Java will achieve similarly in the future with ZGC, but reference counting has very little memory overhead in most cases.

> Reference counting when an object is shared between multiple cores require atomic increments/decrements and that is very expensive

Reference counting with a language like Rust only requires atomic inc/dec when independently "owning" references (i.e. references that can keep the object around and extend its lifecycle) are added or removed, which should be a rare operation. It's not really performing an atomic op on every access.

And memory is cheap, especially when we talk about backend workloads.

A tracing GCs can do the job concurrently, without slowing down the actual, work-bearing threads, so throughput will be much better.

> Golang improves on this quite a bit with its concurrent GC

Not sure what does it have to do with memory overhead. Java's GCs are at least generation ahead on every count, Go can just get away with a slower GC due to value types.