3 ms·
Anti GC isn't a religion. GC is a performance cliff in some cases.
by Ygg2 4y ago
Anti GC isn't a religion. GC is a performance cliff in some cases.
- pjmlp 4y agoIt is certainly a religion, as most people that advocate against it hardly ever learned to use a profiler, or bothered to learn that not all GC languages are alike, and many of them offer the same capabilities like C and C++ for low level coding.
- Ygg2 4y agoIt's not, collaborating on a C# game engine and what I've seen is basically a lot of skirting around GC, because it's impact shows up in profiler. It has gotten to a point arrays and stack alloc are prefered over List and HashSet were basically forbidden in the hottest path. Except most of C# ecosystem relies on classes and GC. A lot of these problems are caused by overuse of GC-ed classes, and their ease of use.
- pjmlp 4y agoDon't confuse Unity runtime with C#, specially since it lacks all the nice features post C# 7. C and C++ aren't immune to heap abuse as well. You do on C# just like on them, think about data structures, and avoid heap during render loop
- Ygg2 4y agoDid I mention Unity? It was a independently developed engine. The engine is in C# 10. They still ran into limitations where basically "This would be a lot easier if we didn't have GC".
- pjmlp 4y agoWell that is what everyone is actually using nowadays when they state they are doing a game in C#. "This would be a lot easier if we didn't have malloc()/free()", basically. In any case Sony, Nintendo and Microsoft have been doing graphics stuff with C# for their platforms, although they could have kept being pure C++. Also we shouldn't silo ourselves into only C# as discussion point, Go, D, Nim, Swift, Eiffel are also possible examples.
- Ygg2 4y ago> "This would be a lot easier if we didn't have malloc()/free()", basically. Well, not really. It's just some libraries like YamlDotNet copy waaaay more than needed and it shows in serialization. They mostly minimized calling YamlDotNet, but true solution would be a zero copy parser. Other issue was HashSet operation like Clear had huge impact. Think they replaced those with arrays. Third issue was something about flecs and archetype ECS. I don't know if it was a jest, but they mentioned changing GC layout or rewriting GC. Points is, they now face a steep performance cliff. The only way out of it is through sheer effort. So no, it's not anti-GC religion. Some domains and GC really badly mix.
- throwaway17_17 4y agoMy take on this is a little different than the comments previous. I tend to side with your position over the default position the GC is workable as a languages base assumption. I think the problem really is an expressiveness issue. In a language conceptualized to have memory managed either manually or GC’d and that said choice should be easily made (i.e. it should not take much work to designate some code path as utilizing a GC’d strategy), but I would say for implementation and performance you would give up being able to easily abstract over the memory strategy. tr;dl — I’d really prefer the option to determine when I’d like GC, as opposed to dodging the collector to avoid performance hits, hot code can default to manual. Probably not a realistic ask, but it could work.
- Ygg2 4y ago> I’d really prefer the option to determine when I’d like GC, as opposed to dodging the collector to avoid performance hits Fair enough. If SS14 used D maybe they wouldn't have these problems. D and early Rust (pre 0.2, like alpha alpha) had that. Problem is you split your community in two. You get a version of "What GC-color is your function/lib?". It's a tradeoff for some domains - allow no GC bypass you're going to run into nigh insurmountable performance cliff. Allow GC as opt-in and you run into issue of splitting your APIs in two.