3 ms·
Incremental GC is very promising for games in favour of traditional stop-the-world GC. It's essentially time sliced GC that runs over multiple frames. Unity sup
by pastrami_panda 7y ago
Incremental GC is very promising for games in favour of traditional stop-the-world GC. It's essentially time sliced GC that runs over multiple frames. Unity supports it and if you tweak if correctly for your needs the GC can run while the CPU is waiting for the GPU.
- chrisseaton 7y agoI don't think there are any GCs that do not stop-the-world at some point, except those with special hardware support, are there? Even C4 requires in theory stopping individual threads, and in practice even has a global stop-the-world phase.
- pastrami_panda 7y agoYes you're technically correct but the time slicing makes it practically different. More here: https://blogs.unity3d.com/2018/11/26/feature-preview-incremental-garbage-collection/ https://blogs.unity3d.com/2018/11/26/feature-preview-increme...
- pcwalton 7y agoIt's easy to write a GC that doesn't stop the world at all. A Baker treadmill [1], for example, is a very simple type of incremental collector that can be implemented quickly. (It's a fun exercise, by the way!) If you implement it "by the book", it will have no stop-the-world pauses whatsoever (assuming the mutator doesn't allocate faster than collection can happen). The problem is that a simple GC like this will have low throughput, so it's not worth it. These are some of the most common misconceptions about GCs: that it's hard to write a low-latency GC and that pauses are all that matter. In reality, GC engineering is all about the tradeoff between throughput and latency. [1]: https://www.memorymanagement.org/glossary/t.html#treadmill https://www.memorymanagement.org/glossary/t.html#treadmill
- pcwalton 7y agoAll the GCs we're talking about here are incremental and have been for decades.
- blattimwind 7y agoIn AAA titles especially gains in hardware are generally not squandered to make the software/engines simpler, but rather invested towards better fidelity or higher frame rates / better frame pacing (which is very, very noticeable). Games are one of few areas where the chronic wasting that is pervasive in almost all other software development is not accepted, by and large.