News for hackers. Stuff that matters.
Re:GC progress from JDK 8 to JDK 17 by dandotway on Wednesday November 24, 2021 @06:02PM (#29336226)
Good point, the Debian Benchmarks Game for example shows C# matching or considerably beating Java at everything except the binary trees benchmark which stresses GC/mempool performance.

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

I haven't tried C#/MonoGame yet but all this discussion is considerably warming me up to it. The recent extremely successful indie game Hades was made with MonoGame.

Microsoft in typical MS fashion makes MonoGame higher friction if you aren't using a Windows box for development with MSBuild. On Linux it appears you need to use Wine to run DirectX effect compilation, though once compiled it works on OpenGL backends:

https://docs.monogame.net/articles/getting_started/1_setting...

Re:GC progress from JDK 8 to JDK 17 by vips7L on Wednesday November 24, 2021 @06:40PM (#29336568)
Thats cause most of the C# implementations in the benchmarks game are just calling into C libraries. For example the regex benchmark:

     [DllImport("pcre2-8", EntryPoint = "pcre2_compile_8", CharSet = CharSet.Ansi)]
        extern static IntPtr PcreCompile(string pattern, long length, uint options,
            out int errorcode, out long erroroffset, IntPtr ccontext);
Re:GC progress from JDK 8 to JDK 17 by throw868788 on Wednesday November 24, 2021 @07:25PM (#29336881)
I just looked at the F# vs Java benchmarks and .NET is still faster on most of them just to get a sample on more idiomatic code. The F# codebase doesn't use a lot of externals looking at the code list

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Only the PiDigits benchmark uses "extern's"; only because it seems like a lazy port. Everything else is native F# code. It beats Java in all benchmarks expect for the binary-tree one. To see a functional language match or beat benchmark level Java on many cases, at least for me, feels kinda nice. Many other real world benchmarks in house (tech choice evaluations) and third party I've seen JVM vs .NET Core also show .NET usually coming out on top recently.

The .NET GC isn't as good as the Java one. But I feel that's because the cost/benefit of improving the CLR's GC is less than Java's so the work is put elsewhere. The language (C#/even F#) generates less garbage in the first place with typical code. Any GC improvements there probably don't have the same bang for buck as in Java where allocations IMO are more frequent in day to day coding.

Re:GC progress from JDK 8 to JDK 17 by whizzter on Thursday November 25, 2021 @04:55AM (#29339861)
There was an article ages ago I read about the rewrite of C#'s Dictionary to the new generic one that went from being reliant on allocations in the older releases (C# 1.0 didn't have generics so iirc it behaved more like Java's) to using a generic struct array.

Doing so cut down the number of memory allocations to _3 allocations_ from something like _2 * N allocations_ (N being the number of elements in the map).

The improvement in performance was apparently staggering when it came to lessening the GC pressure. (Sadly I couldn't find it with a quick google).

https://github.com/microsoft/referencesource/blob/master/msc...

Re:GC progress from JDK 8 to JDK 17 by throw868788 on Thursday November 25, 2021 @06:35PM (#29346068)
Reified generics avoid a lot of "boxing" that comes with standard Java, and that's only one of many features there that helps. Its just easier to avoid allocations in .NET in general over Java IMO. From recent articles and improvements to the platform the team spend their effort to reduce allocations in the first place equal to trying to improve the GC (e.g. ValueTask over Java/Scala futures, etc)
Re:GC progress from JDK 8 to JDK 17 by igouy on Thursday November 25, 2021 @11:06AM (#29342433)
2 out of 10 tasks regex-redux and pidigits accept third-party libraries, the other 8 out of 10 tasks do not.
Re:GC progress from JDK 8 to JDK 17 by kevingadd on Wednesday November 24, 2021 @10:32PM (#29337980)
FYI, Hades was ported from C#/MonoGame to C++ late in development in order to ship on Switch. Their previous titles (Transistor, Pyre, etc) were C# from start to finish though. AFAIK some of their releases use FNA instead of MonoGame (a similar library with more of a compatibility focus.)
Re:GC progress from JDK 8 to JDK 17 by dandotway on Wednesday November 24, 2021 @11:15PM (#29338168)
Great catch! The Wikipedia article for MonoGame lists Hades, but is evidently wrong. Hades used The Forge for graphics. Ctrl/Cmd-F "Hades" on the Github page has some info:

https://github.com/ConfettiFX/The-Forge

The Forge is graphics only; audio, input, etc., have to be handled by something else and Hades used a custom C++ engine apparently.

Re:GC progress from JDK 8 to JDK 17 by chespinoza on Wednesday November 24, 2021 @06:24PM (#29336403)
Wow, first time I've heard about Monogame, I wonder how it'd compare to Godot.
Re:GC progress from JDK 8 to JDK 17 by dandotway on Thursday November 25, 2021 @12:31AM (#29338484)
So I just tried to set up MonoGame as a result of this thread, but with a twist: only use non-Microsoft servers as sources, to see if it really is 'open source'.

It's impossible.

I just spent 30 minutes trying to find a single non-Microsoft mirror for the .NET Core dependency. If MonoGame is your Spice Melange then Microsoft's servers are the planet Arrakis, the only source in the known universe.

On Ubuntu you need to add a Microsoft server as a repo, you can't just "apt-get install dotnet-sdk-6.0".

So, yeah, MonoGame is not for me. I'll stick with Godot or SDL2.