• 0 Posts
  • 50 Comments
Joined 1 year ago
cake
Cake day: July 1st, 2023

help-circle


  • It’s mentioned in footnote 6:

    As an example, to make this work I’m assuming some kind of “true deref” trait that indicates that Deref yields a reference that remains valid even as the value being deref’d moves from place to place. We need a trait much like this for other reasons too.

    It would only work for references that are stable after the value they reference is moved. Think for example of a &str you get from a String.











  • Loop unrolling is not really the speedup, autovectorization is. Loop unrolling does often help with autovectorization, but is not enough, especially with floating point numbers. In fact the accumulation operation you’re doing needs to be associative, and floating point numbers addition is not associative (i.e. (x + y) + z is not always equal to (x + (y + z)). Hence autovectorizing the code would change the semantics and the compiler is not allowed to do that.