3 ms·
I think C#/.NET has more performance-oriented affordances than Java: - It supports structs, and unboxable structs called "ref structs". They let you to avoid G
by sedatk 4y ago
I think C#/.NET has more performance-oriented affordances than Java:
- It supports structs, and unboxable structs called "ref structs". They let you to avoid GC/heap-alloc for small data structures with clear ownership semantics.
- It uses type reification for generics instead of type erasure. Combined with value-types, this can produce very optimized code. The downside is larger binary sizes.
- It allows unsafe programming with pointer arithmetic where performance is truly critical. This is where C# is closer to C/C++ than Java.
- Supports native compilation to a target architecture. This lets you avoid JIT overhead and lets you ship self-contained binaries (like Go).
- .NET supports source generators which can let you keep maintainable code and generate an optimized one.
Performance aside, C# is a very pleasant language to use, and .NET is a delightful runtime. I'd say give it a try and see it for yourself.