News for hackers. Stuff that matters.
Re:Why Is C Faster Than Java (2009) by codr7 on Monday December 27, 2021 @09:15AM (#29702645)
Re-implementations often turn out faster simply because you understand the problem better, which seems to be the case here.

The same algorithm not going to run faster in Rust than tuned C, period. Just like C is never going to run faster than tuned Assembly. I wish we could move on to discussing something that matters.

Re:Why Is C Faster Than Java (2009) by specialist on Monday December 27, 2021 @11:00AM (#29703544)
Implementation vs performance. And hand-coded assembly would likely be faster still. So what?

u/josephg's point is the that implementing equally performant code in 'C' was cost prohibitive for them.

This is applying the principle behind "economics of compiler optimizations" writ large. Not a religious battle.

Re:Why Is C Faster Than Java (2009) by josephg on Monday December 27, 2021 @04:18PM (#29706879)
> The same algorithm not going to run faster in Rust than tuned C, period.

Weirdly enough, before I added that optimization my rust code was ~20% faster than the C code anyway. And I have no idea why - the programs were (as far as I could tell) identical. I was using the same compiler backend (llvm) and before alias analysis was turned on for rust. And -march=native in both cases.

Could just be a weird coincidence of the compiler’s inlining decisions - though I suspect not. I tried investigating it but I don’t understand x86_64 assembly enough to understand how the binaries differ.