Hacker News new | ask | show | jobs
by emsy 3344 days ago
Unity games are often reported to have performance issues, allegedly due to the underlying GC (or lack of understanding of it). I'd rather hope for the adoption of a less messy C++ alternative that is suitable for quasi-realtime applications. So far Jai seems to be the most serious competitor in this regard.
4 comments

Because Unity uses a Jurassic Mono implementation with a stone age GC and JIT implementation.

By the same metrics, we should evaluate performance of C and C++ code by using benchmarks with MS-DOS C and C++ compilers, which should be about the same age.

Don't mix languages with implementation when talking about performance.

Amen brother. I think most perf problems in Unity games would go away if Unity updated their GC. It's definitely our #1 source of frame rate hiccups. Plus, it makes you write weird crappy code just to avoid GC allocations. Ugg =(
Are there plans to replace Mono with .NET Core?
No, Unity guys are doing their own thing with IL2CPP.

Basically they generate C++ from MSIL as a means to generate native code, instead of building their own compiler backend.

They plan however, to eventually update their Mono runtime.

https://forum.unity3d.com/threads/future-plans-for-the-mono-...

> So far Jai seems to be the most serious competitor in this regard.

1. Jai is not even released.

2. Jai is a programming language, not a game engine.

Unity is slow because they are using an outdated C# implementation (some old Mono).

1. If you follow its development you know the features and the design philosophy. What's your point? 2. I picked Unity because it's the most popular engine with an underlying GC.

Regardless of their GC implementation, in games you don't want opaque runtime behaviour, which a GC always introduces. This leads to weird workarounds in your code that nobody understands instead of having clear and explicit memory management.

My point is that until a language is proven, as in used on a large scale it is just a nice idea. Let's wait until Jai is released and used by different teams for different tasks until we proclaim its superiority.
I didn't claim superiority, I just that it's the most serious competitor. A point I still stand by. The original post compared the adoption of C# to the adoption of C++, the now de-facto standard for games. C# does not have what it takes to become the de-facto standard for games.
Sure it does.

C++ became a de-facto standard for games, because console SDKs moved from C to C++, pushed by the companies selling them.

The same companies that are now adopting Unity and have already toyed with the idea of having a C# SDK.

If for the sake of example, PS5 SDK would be C# based, devs that wanted any money from PS5 games would adopt it, regardless of their feelings regarding C++ vs C#.

>If for the sake of example

This is a terrible example and you have no idea what you're talking about.

Not to be too pedantic but I'm pretty sure he's never actually referred to it as "Jai" and everyone's only been inferring that because of the source file extensions.
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?

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.