News for hackers. Stuff that matters.
Re:The Death of Optimizing Compilers by kibwen on Saturday March 14, 2015 @11:37PM (#9205273)
It's not a priority for Rust to hoist subscript checks in loops, because Rust uses iterators pervasively and iterators are guaranteed to check the bounds of the array no more than once.
Re:The Death of Optimizing Compilers by dbaupp on Sunday March 15, 2015 @08:35PM (#9208917)
LLVM (used by rustc) is perfectly capable of hoisting and eliminating subscript checks, although I believe rustc doesn't necessarily drive LLVM in the optimal way, yet: https://github.com/rust-lang/rust/issues/22987

E.g. this has no bounds checks, and is in fact vectorised:

  pub fn bad_sum(x: &[i32]) -> i32 {
      let x = x; // *
      let mut sum = 0;
      for i in 0..x.len() {
          sum += x[i]
      }
      sum
  }

The line marked * is needed because of https://github.com/rust-lang/rust/issues/22924 which is caused by https://llvm.org/bugs/show_bug.cgi?id=22786 .
Re:The Death of Optimizing Compilers by Animats on Sunday March 15, 2015 @12:35AM (#9205372)
Write a matrix multiply. Or a linear equation solver.
Re:The Death of Optimizing Compilers by pcwalton on Thursday March 19, 2015 @05:48PM (#9234825)
The bounds checks for matrix multiplication over fixed length arrays are completely optimized out by LLVM, and LLVM will also optimize the bounds checks for non-fixed-length arrays in many cases. The slice length is an SSA value, so it's subject to constant propagation and SCCP.