Re:Why Is C Faster Than Java (2009)
by bombcar on Monday December 27, 2021 @12:12AM
(#29699506)
Theoretical max performance is different from actual performance - and since all code on a given machine ends up in machine code all languages are the same speed - which is obviously false.
[ Parent
| on HN ]
Agreed. I should have added to my initial post that I think language speed comparisons are absolutely stupid for the reasons I mentioned.
I don't go around saying C is faster than Java. I just say Java cannot be faster than C.
But not all languages emit the same machine code. And I think performance is more sensitive to memory access than machine instructions, so I don't think this point is true.
The point is that a language can be faster than the language it is written in - all or for the most part - depending on how it is used. Saying "the theoretical performance of Java can never be faster than the theoretical performance of C" is a tautology and pretty useless - especially if in practice the Java libraries handle normal operations better than the average C programmer.