basically same speed, but c# is sometimes a lot faster
is there a better benchmark?
slightly off topic, if go isn’t really faster than c#, why use it in the first place? subjective thoughts welcomed.
The question “what language is faster?” is a common one, but fraught with complications, consider:
the quality of compilers for a language may differ between platforms
there may be multiple ways of compiling a language with differing performance tradeoffs on any given platform
a language may be slow when used “idiomatically” but capable of producing fast code if you really want to. Would it make sense, for instance, to compare a C# program that uses lots of unsafe and simd intrinsics to a pure Go implementation, for instance? It might, just depends what you want to measure. But you can be sure it will anger one side or the other no matter what choice you make.
there are millions of different kind of programs and millions of ways to write each one of them. these will all have different performance needs and trade offs.
one language may be faster than another, but high quality libraries in the ecosystem of the slower language may allow you to easily create faster programs. Think of, for instance, Python with it’s machine learning and math ecosystems, backed with super fast C code. Is it fair to compare python calling into C libs vs C#? Sure, depends what you want to know. But people will argue!
All of that said, you can expect some general trends in Go vs C# performance:
Go will tend to have shorter GC pauses, which is great for things like games
But Go will tend to spend more total time doing GC than C#, which is bad for not games.
Go has more expensive FFI (bad for games!)
Because Go is normally ahead of time compiled, and C# is normally Jitted,Go programs will generally start up quicker. Good for command line programs! But, you *can* ahead of time compile C# too.
Idiomatic C#, with lots of linq calling into virtual functions and everything behind interfaces, may tend to be slower than idiomatic Go, which tends to be lower level.
C# will tend to have a higher performance ceiling when you want it, and the benchmark game bears this out. C# tends to beat Go, but the solutions have lots of unsafe and other tricks.
As with everything related to perf: it depends.
There are plenty of cases where Java is faster than C# and others where C# is faster that C++.
C# is *my* preferred language because it lets you not care about the nitty gritty details that C/C++ makes you think about, but lets you get into them if you want (unsafe, pointer filled code, hardware intrinsics for SIMD, etc)
I haven’t done anything with Go other than a hello world years ago, but from what I’ve heard C# is a nicer language to work with. I can’t comment on comparing the run time characteristics.
Just for reference, the TechEmpower benchmarks are frequently discussed. For example, ASP.NET Core’s plain http benchmark beats literally everything
https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=plaintext
whereas on the JSON benchmark it falls behind
https://www.techempower.com/benchmarks/#section=data-r19&hw=ph&test=json
You can build basically anything in C# to have top-of-the-line performance, it might just be a lot of engineering work.
C# is lightning fast and I would not be surprised if it is faster than Go. Go was built around concurrency and might beat c# in highly concurrent applications. However, unless you have a very specific use case, IMO the speed of a programming language does not matter that much. What matters is the speed of individual frameworks you use (ASP, Entity Framework vs. whatever Go uses). This website provides some good benchmarks between various frameworks and languages. The performance differences between languages can easily be dwarfed by poorly written code or inefficient database schema. Therefore, people might choose to use go even if its slightly slower in some cases. Just like I choose to use C# even though its slower than C++ / Rust in some cases.