Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

C# is consistently a worse performer than most javascript runtimes currently, and it's not much better than Python, Ruby, and PHP.

It's not just that. Basic patterns in C# are known to have pathological performance problems (implicit boxing, implicit heap allocations) that you simply don't run into programming in C or C++. These are things that tank performance in day-to-day programming that do not show up in carefully tuned benchmarks.

Source: Helped profile lots of C# games (not IL2CPP with Unity, although that's pretty bad IMO as well), not pleased with what I saw.



> C# is consistently a worse performer than most javascript runtimes currently

This is a bold claim. Please provide evidence that the most current .NET implementation (.NET Core 3.1) is slower than any JavaScript implementation.

This doesn't pass the smell test since you're comparing an ahead-of-time statically typed approach to a dynamic scripting language, both of which have had highly tuned JIT implementations, both of which are using garbage collection. You can implement things poorly in C#, sure, but you're making a much stronger claim of consistently poor performance.

Saying 'dude trust me' is not a source.


Agreed. Take a look at https://www.techempower.com/benchmarks/#section=data-r19&hw=...

C# currently 1st place in this webserver benchmark. Ahead of C/C++/Go/Java/D.

No offense to JavaScript, I like it and it has its uses. But surely your OP is joking when saying JavaScript is faster than C#. Even after all the performance improvements that V8 received.


At least C# has things like the struct keyword to prevent heap allocations for simple data structures. I don't know if recent Java has caught up with this, but it was one of the innovative features MS came up with for .NET to avoid unnecessary overhead.

I feel like it's possible to write careful C# for performance. It just won't be entirely idiomatic. Things like buffer re-use, ordinary techniques you'd need to apply manually for C and C++ in similar domains too.


A large part of C#'s advancements are that additional abstractions have been added in .NET Core to make at least some of those concepts a bit more idiomatic, especially around passing segments of memory around.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: