Hacker News new | ask | show | jobs
by stcredzero 3344 days ago
Unity games are often reported to have performance issues, allegedly due to the underlying GC (or lack of understanding of it).

Is there a way of running C# with reference counting?

2 comments

At that point you've created a different language with different semantics.
I think "you can write C#, but you can only have your references form a DAG" would be acceptable in a lot of contexts, like game programming. (Existing libraries would still require some form of tracing, but I think there are ways that the tracing could be handled by another thread.)
I instinctively get that thought whenever I work with C#. It's really nice but would it kill them to at least offer simplistic memory management semantics?
People think RC as GC algorithm is simpler, but it isn't.

Naive implementations are slower than tracing GC, while high performance ones are as complex as tracing GC ones, while having the burden of forcing the developers to explicitly deal with cycles.

high performance ones are as complex as tracing GC ones, while having the burden of forcing the developers to explicitly deal with cycles.

I bet there are plenty of game developers who would be only too glad to arrange their references as a DAG, if they could have guaranteed low latency.

Maybe, but if they don't take care, some stack overflow surprises might happen, the fun of cascade deletions.