Live data from Hacker News

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

benchmarksgame-team.pages.debian.net

21–30 of 114 posts

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

#21
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:…

I definitely have run into this, even when using 'server mode' in asp.net core. I never was able to figure out why the C# version of my POC was using so much memory, but rewriting to golang ended up using a very predictable, minimal amount of memory in comparison.

Server mode is much less likely to incur GC. Were you causing enough memory usage to force your app to actually free memory?

It will intentionally use more memory for the sake of throughput, hence why this post has all .NET program flag for it, as it's a _speed_ benchmark primarily.

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

#22
post #9

Earlier quoted context omitted.

I definitely have run into this, even when using 'server mode' in asp.net core. I never was able to figure out why the C# version of my POC was using so much memory, but rewriting to golang ended up using a very predictable, minimal amount of memory in comparison.

My guess is that golang's GC is optimized for latency at the expense of throughput, limiting the max memory size.

nah he just compares two different things. basically his golang hello world probably had basically nothing while his dotnet version used the "Microsoft.NET.Sdk.Web" which basically pulls the shared framework which will load a ton of stuff. BUT even after that the memory usage might be bigger. however does it really matter? I mean dotnet is not a big memory hog. it's pretty lightweight for what it is. compare it to java and the golang number would be insane.

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

#23
It's 2021 and .NET developers still argue which coding style they should adopt and how they should enforce it. It's totally mind numbing that team members are split between implicit and explicit variable naming. Contrary, in Go you just write code because those nuances should not matter.

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

#24

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…

reminds me of the 'im tired of being a hipster' post on frontpage recently.... "go learn 'unhip' tech/languages and live your life"

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

#25

Earlier quoted context omitted.

> even ships with its own cloud environment (Azure) Can you elaborate on this? What does it mean that ".Net ships with Azure"?

Microsoft created .NET and Azure and a lot of the tooling so the integration is tight, now that it's multi platform and with Rider (multiplatform .NET IDE) being as good as if not better than Visual Studio there is nothing stopping it.

What does it mean "the integration is tight"? Are we talking about good Azure libraries, or is there some runtime integration (e.g., a .Net orchestrator i.e., Kubernetes but for .Net applications rather than containers)? Or does it just mean that Azure is better than other clouds at running .Net because it's a first-class citizen where it's usually second-tier on AWS/GCP?

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

#27
post #24

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…

reminds me of the 'im tired of being a hipster' post on frontpage recently.... "go learn 'unhip' tech/languages and live your life"

This one?

https://news.ycombinator.com/item?id=28274485

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

#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 even more important than the compiling speed. It's easier and cleaner to keep the compiler simple and write optimized assembly code by hand when it's needed. That way, the compiler doesn't get so messy (fewer bugs, easier to maintain...) and the written program is of better quality (humans can produce better code than compilers).

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

#29
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:…

[deleted]

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

#30
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 don't think it was "limited developer resources" so much as a desire to preserve blazing-fast compile times. The very rough rule-of-thumb that I've heard is that optimizations must pay for themselves (a compiler which is itself compiled with the given optimization must not be slower than the previous version).

"He used the compiler's self-compilation speed as a measure of the compiler's quality. Considering that Wirth's compilers were written in the languages they compiled, and that compilers are substantial and non-trivial pieces of software in their own right, this introduced a highly practical benchmarks that directly contested a compiler's complexity against its performance."

p44 "Oberon — The Overlooked Jewel" Michael Franz, in "The School of Niklaus Wirth".

https://www.google.com/books/edition/The_School_of_Niklaus_W...

Post reply on HN