5 ms·
Every Rust SIMD article should mention the .chunks_exact() auto vectorization trick by law.
by rwaksmunski 8mo ago
Every Rust SIMD article should mention the .chunks_exact() auto vectorization trick by law.
- ChadNauseam 8mo agoDidn't know about this. Thanks! Not related, but I often want to see the next or previous element when I'm iterating. When that happens, I always have to switch to an index-based loop. Is there a function that returns Iter<Item=(T, Option<T>)> where the second element is a lookahead?
- tyilo 8mo agoYou probably just want to use `.peekable()`: https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.peekable https://doc.rust-lang.org/stable/std/iter/trait.Iterator.htm...
- SkiFire13 8mo agoNote that `peekable` will most likely break autovectorization
- rwaksmunski 8mo agoI use the slice::windows for that.