Rust indexing w/o bound checks?

I know this is a terrible terrible idea. Is there a way to disable bound checking on certain access to a Vec ?

Context: I'm benchmarking some sgemm code; I'm doing something stupid where transposing a matrix is taking more time than sgemm. I (without much evidence) suspect this might be due to bound checks, and want to see if there is a way to disable bound checks.

https://doc.rust-lang.org/stable/std/primitive.slice.html#method.get_unchecked

2 Likes