TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

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

101 pointsby iamdualover 3 years ago

12 comments

throwaway894345over 3 years ago
I can&#x27;t imagine a better setup for a language flame war :). I really like debating languages, so I hope it doesn&#x27;t go that direction.<p>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&#x27;s memory management is low latency and non-moving, so allocations are expensive--any Go programmer writing a performance-sensitive btree implementation would pre-allocate the nodes in a single allocation--an absolutely idiomatic and <i>trivial</i> optimization--but the benchmark game requires that the nodes are allocated one at a time. In other words, the C# version is idiomatic, but the Go version is expressly contrived to be slower--not a very useful comparison.<p>Mad respect for .Net though; it&#x27;s really impressive, I like the direction it&#x27;s going, I&#x27;m glad it exists, etc.
评论 #28294363 未加载
评论 #28294557 未加载
评论 #28293864 未加载
评论 #28294308 未加载
Thaxllover 3 years ago
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.<p>Overall you can see how fast Go is, it has little optimization compare to C# and it&#x27;s as fast. Compare this: <a href="https:&#x2F;&#x2F;benchmarksgame-team.pages.debian.net&#x2F;benchmarksgame&#x2F;program&#x2F;nbody-go-3.html" rel="nofollow">https:&#x2F;&#x2F;benchmarksgame-team.pages.debian.net&#x2F;benchmarksgame&#x2F;...</a> and overly complicated C# version: <a href="https:&#x2F;&#x2F;benchmarksgame-team.pages.debian.net&#x2F;benchmarksgame&#x2F;program&#x2F;nbody-csharpcore-6.html" rel="nofollow">https:&#x2F;&#x2F;benchmarksgame-team.pages.debian.net&#x2F;benchmarksgame&#x2F;...</a> ( avx, Intrinsics etc ... )
评论 #28293366 未加载
评论 #28294604 未加载
评论 #28295570 未加载
评论 #28293944 未加载
评论 #28294119 未加载
Guillaume86over 3 years ago
The focus on performance since Core is really nice to see, dotnet 6 is continuing the trend as well: <a href="https:&#x2F;&#x2F;devblogs.microsoft.com&#x2F;dotnet&#x2F;performance-improvements-in-net-6&#x2F;" rel="nofollow">https:&#x2F;&#x2F;devblogs.microsoft.com&#x2F;dotnet&#x2F;performance-improvemen...</a>
keewee7over 3 years ago
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.
评论 #28294307 未加载
评论 #28294220 未加载
评论 #28294369 未加载
scanrover 3 years ago
I enjoy using both languages. The significant performance difference between the two for me is compilation speed. Size of binaries produced is also important if you’re shipping them around.
flyinglizardover 3 years ago
I say modern .NET is a marvel of features, development tools, interoperability, performance and even ships with its own cloud environment (Azure).<p>Unfortunately developers who don’t know better judge it by it’s historical association with Windows rather than how powerful it is today.
评论 #28294066 未加载
评论 #28293432 未加载
评论 #28294898 未加载
评论 #28293444 未加载
评论 #28296008 未加载
mellingover 3 years ago
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.<p>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.<p><a href="https:&#x2F;&#x2F;benchmarksgame-team.pages.debian.net&#x2F;benchmarksgame&#x2F;fastest&#x2F;rust-go.html" rel="nofollow">https:&#x2F;&#x2F;benchmarksgame-team.pages.debian.net&#x2F;benchmarksgame&#x2F;...</a>
评论 #28293419 未加载
评论 #28293942 未加载
评论 #28293550 未加载
booleandilemmaover 3 years ago
I&#x27;m not really concerned with such small differences in speed, to be honest. The thing that I look for is: how productive am I when using language X?
评论 #28295523 未加载
nedsmaover 3 years ago
It&#x27;s 2021 and .NET developers still argue which coding style they should adopt and how they should enforce it. It&#x27;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.
评论 #28293992 未加载
评论 #28298017 未加载
matttproudover 3 years ago
I&#x27;ve never understood why folks treat the Benchmarks Game results as indicative nor representative of anything useful. The code specimens they use are often unpolished nor idiomatic, without even commenting on whether they could be made to perform better through Byzantine, careful by-hand optimization.<p>Why does their web site have no contact nor link to where the source code for the project can be checked out, contributed to, or amended?
评论 #28296009 未加载
评论 #28296094 未加载
fulafelover 3 years ago
Please fix the title (the original title spells Go correctly too).
popotamongaover 3 years ago
Is there one similar for c# vs scala?
评论 #28294045 未加载