Live data from Hacker News

Golang vs. C# (.NET 5.0) at Benchmarks Game

benchmarksgame-team.pages.debian.net

51–60 of 114 posts

Re: Golang vs. C# (.NET 5.0) at Benchmarks Game

#51

I can't imagine a better setup for a language flame war :). I really like debating languages, so I hope it doesn't go that direction. One of the standard caveats with this particular benchmark game with respect to Go is idiomatic optimizations are prohibited. To use the btree example, Go's memory management is low latency and non-moving, so allocations are expensive--any Go programmer writing a performance-sensitive…

The point of the btree example is to test how good programming languages are at allocating tree-like structures that can't be preplanned. It's a valid argument that this is a rare real-world requirement, but it's not contrived to be slower.

Re: Golang vs. C# (.NET 5.0) at Benchmarks Game

#52
post #3

When you see how much effort it takes to C# and Java to optimize the runtime, there are a lot of people working on that. C# is fast but you see that it uses between 2 and 32 times the memory that Go needs. Overall you can see how fast Go is, it has little optimization compare to C# and it's as fast. Compare this: https://benchmarksgame-team.pages.debian.net/benchmarksgame/... and overly complicated C# version: https:…

and afaik, .net has record types unlike the jvm (yet) which means java is even worse

I think you mean structs (value types. Will be called primitive types in Java). Records are not too interesting from a performance pov (and java has them, and I think they actually predate c#’s), though java will likely be able to optimize serialization/deserialization of records better.

Re: Golang vs. C# (.NET 5.0) at Benchmarks Game

#53
post #35

I prefer C#. But here the Go code actually looks like normal production code while the C# examples look like something made by a low-level optimization wizard.

If what's in the Benchmarks Game is normal Go code to you, then I feel pretty bad for you in terms of what your colleagues are exposing you to on a day-to-day basis quality-wise.

Re: Golang vs. C# (.NET 5.0) at Benchmarks Game

#54
post #28
post #4

I was always under the impression that Go never had a great optimizing compiler. It was never a primary focus given the limited developer resources. I couldn’t find a direct C# to Rust comparison but Rust trying to compete with C++ means performance is a goal, if that’s what you are after. https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

> I was always under the impression that Go never had a great optimizing compiler. It was never a primary focus given the limited developer resources. It's an intentional choice, that's why it compiles code so fast. Also because of that it's a lot simpler than say GCC. Before Go, the Plan 9 C compiler was designed in a similar manner too (I think the Go compiler was forked from it). I think the simplicity aspect is e…

How often have you met compiler bugs? Also, humans absolutely can’t produce better code than compilers, at least not reliably. All those minor improvements that compilers routinely do does add up. And noone wants to write arcane hacks that make code unmaintainable and may not even provide a performance benefit (CPUs are finicky beasts, sometimes the seemingly worth option is faster)

I very much want my computer to work as hard as it can to make my code more performant for free. What I would like to see more is a separate debug and release build mode, where the former can go as fast as it can without optimizations, while the latter can be as slow as it wants and result in the most optimal binary it can produce. Zig does that for example.

Re: Golang vs. C# (.NET 5.0) at Benchmarks Game

#55
post #36

Is there one similar for c# vs scala?

Many years ago — but from version-to-version too many of the Scala programs suffered bad bitrot, failed and were not updated.

Scala code is backwards compatible, only the class files are not - so at most dependencies could have become stale. With a recompile, the programs should work just fine.

Re: Golang vs. C# (.NET 5.0) at Benchmarks Game

#56
post #37

I say modern .NET is a marvel of features, development tools, interoperability, performance and even ships with its own cloud environment (Azure). Unfortunately developers who don’t know better judge it by it’s historical association with Windows rather than how powerful it is today.

> Unfortunately developers who don’t know better judge it by it’s historical association with Windows rather than how powerful it is today. Some of us actually got to experience the entire journey from the old to new world first-hand. We started out as a .NET 3.5 Framework solution (windows only), and are now looking at a .NET 6 upgrade (any platform). Over the course of 7+ years, we went through all of the following…

Well, without starting a flamewar (.NET is an impressive runtime), the JVM is better at backwards compatibility, I think.

Re: Golang vs. C# (.NET 5.0) at Benchmarks Game

#57
post #11

I say modern .NET is a marvel of features, development tools, interoperability, performance and even ships with its own cloud environment (Azure). Unfortunately developers who don’t know better judge it by it’s historical association with Windows rather than how powerful it is today.

Can you now get the full .NET development experience in a Linux-only environment? I haven't used it in a while, but from using Unity (game engine) it seemed like C# on Linux was a bit crippled

I use Sublime and it works well.

Re: Golang vs. C# (.NET 5.0) at Benchmarks Game

#58

Earlier quoted context omitted.

Are we looking at the same file?[0] Tons of very "interesting" attributes like this: // prevent inlining into main to decrease JIT time to generate main [SkipLocalsInit][MethodImpl(NoInlining)] [SkipLocalsInit][StructLayout(LayoutKind.Explicit, Pack = 32)] [SkipLocalsInit][MethodImpl(AggressiveOptimization | NoInlining)] [FieldOffset(32)] and tons of "unchecked" blocks. Not to mention that the entire file is using ex…

Agree - those attributes are definitely “low level” and not idiomatic in most situations. I must have missed them skimming that file. For the particular case of n-body you could argue you are already in a pretty extreme HPC world and doing it without vectors would basically be a toy calculator. The problem then of course that C# isn’t really ever idiomatic for that. The question (as alaways) becomes about what to com…

Choices! choices!

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

Re: Golang vs. C# (.NET 5.0) at Benchmarks Game

#59

I can't imagine a better setup for a language flame war :). I really like debating languages, so I hope it doesn't go that direction. One of the standard caveats with this particular benchmark game with respect to Go is idiomatic optimizations are prohibited. To use the btree example, Go's memory management is low latency and non-moving, so allocations are expensive--any Go programmer writing a performance-sensitive…

That is one reason I don't consider the language benchmark to be really relevant: a lot of benchmarks are taited by the exact rules of the competition.

Re: Golang vs. C# (.NET 5.0) at Benchmarks Game

#60
post #3

When you see how much effort it takes to C# and Java to optimize the runtime, there are a lot of people working on that. C# is fast but you see that it uses between 2 and 32 times the memory that Go needs. Overall you can see how fast Go is, it has little optimization compare to C# and it's as fast. Compare this: https://benchmarksgame-team.pages.debian.net/benchmarksgame/... and overly complicated C# version: https:…

Compare this and C# version:

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

Post reply on HN