3 ms·
For one, in typical code, the Rust compiler can make more aggressive optimizations because every `&mut` is guaranteed not to alias. The C++ equivalent, from th
by tomjakubowski 7y ago
For one, in typical code, the Rust compiler can make more aggressive optimizations because every `&mut` is guaranteed not to alias. The C++ equivalent, from the optimizer's standpoint, is `T * restrict`, which is rarely used (and harder to use correctly) by comparison.
- lossolo 7y agoBut is it used? From what I remember aliasing information provided was not used by LLVM. Did anything changed?
- dodobirdlord 7y agoI believe the code miscompilation bug in LLVM that was blocking enabling it was fixed. That said, it's gone back and forth now several times as new bugs get discovered. The code paths in GCC and LLVM for noalias optimizations aren't particularly battle-tested because C and C++ basically don't use them.