3 ms·
> After all, those languages use the same backends - GCC in the case of C & Ada, LLVM in the case of C & Rust. The killer flaw of C for performance is the poin
by jcranmer 8y ago
> After all, those languages use the same backends - GCC in the case of C & Ada, LLVM in the case of C & Rust.
The killer flaw of C for performance is the pointer aliasing problem. C only has the very coarse-grained tools of strict aliasing (often disabled in large applications because it breaks code!) and restrict (which relies heavily on manual programmer annotation) to control these aliasing issues. Since Rust has the rule that you can only have one mutable reference to an object at once (and read-read aliasing issues don't matter), it can effectively automatically add in these annotations without relying on programmer annotation.
- arcticbull 8y agoI think it's fair to say that "average" Rust code will be faster than "average" C code due to lack of pointer aliasing issues as the average developer doesn't care about/understand this enough to make the annotations in any codebase I've worked in. Can you make both equally fast? I don't see why not, they're both LLVM.
- setr 8y agoGiven enough time, effort and smarts, you can probably make any lang as fast as any other :-)