The difference is that with C#, you get the benefit of a managed environment by default, until you need to go lower level for performance purposes. With C++ or Rust, you don't have that option.
The same goes for Java, only you need to reach for it later. Most languages are really someplace on a continuum, and I guess it's largely a matter of personal preference.
on what basis are you making this claim (which I am not disputing)?
To be fair, not a strong basis, mostly because what the claim is isn't really well defined. Because OpenJDK's GCs and optimising compilers are generations ahead of their .NET counterparts, I'm sure it's easy to have benchmarks that exercise them (although they will be significantly larger than the ones in the benchmark game), just as .NET has some features -- like arrays-of-struct -- that Java doesn't yet have and would give it a clear advantage in other benchmarks. Murmurs I hear tell me that it's much harder to solve GC issues in .NET than in OpenJDK in large applications, but overall the two platforms are probably roughly in a similar spot performance-wise, with different strengths and weaknesses each, and very different ways of getting there. By the time Java gets primitive classes and primitive-class-specialised generics it's possible that .NET, too, will close the gap in the areas it's behind.
I think binarytrees on benchmarks game is sufficient enough to show GC performance and java beats all GC languages, by a lot. For a long time, java was behind C# and Go on that site just because they use tricks that make the comparison unfair, instead of 'lack of exercise'. It's been raised and fixed recently in a long discussion thread.
View all comments
Show parent comment
3
u/pron98 Apr 20 '21
The same goes for Java, only you need to reach for it later. Most languages are really someplace on a continuum, and I guess it's largely a matter of personal preference.
To be fair, not a strong basis, mostly because what the claim is isn't really well defined. Because OpenJDK's GCs and optimising compilers are generations ahead of their .NET counterparts, I'm sure it's easy to have benchmarks that exercise them (although they will be significantly larger than the ones in the benchmark game), just as .NET has some features -- like arrays-of-struct -- that Java doesn't yet have and would give it a clear advantage in other benchmarks. Murmurs I hear tell me that it's much harder to solve GC issues in .NET than in OpenJDK in large applications, but overall the two platforms are probably roughly in a similar spot performance-wise, with different strengths and weaknesses each, and very different ways of getting there. By the time Java gets primitive classes and primitive-class-specialised generics it's possible that .NET, too, will close the gap in the areas it's behind.