pub fn cpu_continuous_count_simd_n<const LANE_SIZE: usize>(
chunk: &[u8],
byte: u8,
) -> Option<usize>Expand description
Use SIMD to find the index of a byte in a byte slice.
ยงNote
We try saturating the CPU SIMD ports with ops. If we had to do all CPU_SIMD_AVERAGE_ALU_COUNT passes to find the needle, we essentially speculatively precomputed the index. Our worst case is if we only had to do one pass to find the needle, but we are relying on out-of-order execution and the cheapness of SIMD to hide the latency. This also serves as a form of prefetching the byte slice into the cache lines, so beware of thrashing it.