Hacker News new | ask | show | jobs
by Cyph0n 1924 days ago
For game dev (and emulators!), the non-deterministic behavior of GCs can cause a lot of trouble, mainly because you have a fixed frame budget. That’s why it’s usually easier to just use a language where you can finely control when and where allocations take place.

I’m sure there are techniques to work around this, but you’d then usually have to leave behind the “idiomatic” area of the language you’re using.

2 comments

Yes, In C# you have to leave the idiomatic side somewhat to get the most performance. Though this is getting better in latter versions of C#, in which you get more low level coding features. But for me the fun part is doing exactly that. Coding as close to the metal as possible, leaving the "safe" side of C# but still using the Quality of Life features that C# offers compared to C++. That for me makes C# my favorite language ever.
I like C# and use it a lot, but for performance sensitive apps I need SIMD. Microsoft is making improvements, but not enough, still a long way to be comparable to C++. Currently, they don't support NEON on 32-bit ARM, and have performance issues in the JIT: https://github.com/dotnet/runtime/issues/13811
C# is one of the most popular languages to write games in (with Unity), so it can't be that bad. I'd expect it to perform well if you only allocate short-term objects, since it can do escape analysis and figure out they can all go on a stack, but I don't know how Mono's GC works.