Nice result to end the day (night*): After discussions with @imartayan.bsky.social, the SIMD minimizer code now also does proper canonical (revcomp) minimizers: ~1ns/bp for fwd minis +0.4ns/bp with collect and dedup +0.6ns/bp with canonical hashes. Super happy how it's only 2x slower in the end!
Post
Collecting is non-trivial because we have to go from a Vec<Sims> covering 8 chunks in parallel to a single linear vec. Some 8x8 u32 simd-matrix transpose from stack overflow did it nicely :) And then a neat linear dedup based on a version on @lemire.bsky.social's blog
But especially the canonical part is cool. This requires extra work: - a reverse-complement-invariant hash. So compute RC-nthash on the fly as well. - rightmost minimum in a window alongside leftmost - determining whether a kmer is canonical, based on #AC<>#GT. All that fits in 0.6ns, or 2 cycles 🤯
1 repost4 likes