Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Don'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



Did 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".


My 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.


> 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.


Well 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.


> "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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: