← Back to context

Comment by OnACoffeeBreak

9 months ago

The author says that they tend to load all of the assets on init. This sidesteps the issue of the C#'s garbage collector (GC). I am not a C# developer, but seem to recall reading that GC can cause unexpected slow downs. Web search shows articles on tips and tricks for optimizing GC in C#, so it seems like a real issue.

Does anyone have any first hand experience they would like to share? Is it easy to avoid the GC slowing down your game unexpectedly? Is it only a problem for a certain class of games?

There’s a recent promising development relevant to the GC pause issue. It seems couple weeks ago some smart developer working for Microsoft has made a version of GC called “Satori” which pretty much solved these GC pauses for many real-world use cases.

An overview article: https://blog.applied-algorithms.tech/a-sub-millisecond-gc-fo...

Long discussion thread with many graphs with measurements: https://github.com/dotnet/runtime/discussions/115627

I don’t yet have hands-on experience with that Satori GC, though.

In a game like the author's where you just init/pool everything on load you can simply disable the garbage collector during gameplay.