I'm not familiar with Neon instructions at all so I didn't do very deep inspection.
The only thing I'd like to see is a unit test to assert xor_product output is the same as the default implementation. That would ensure that the SSE/Neon implementations are correct (when tested on those platforms).
It would literally be something like:
#[test]
fn test_xor_product() {
// Have some test data here
for (v1, v2) in vectors {
assert_eq!(
EncodedVectorsBin::xor_product(&v1, &v2),
v1.iter()
.zip(v2)
.map(|(b1, b2)| (b1 ^ b2).count_ones() as usize)
.sum()
);
}
}
I guess such test is not necessary. We have unit tests for binary quantization and each test covers xor. I would discuss testing of non-accelerated xor calculation but I decided to skip it. Because the implementation and test (like in your example) are absolutely the same parts of code
I guess such test is not necessary. We have unit tests for binary quantization and each test covers xor. I would discuss testing of non-accelerated xor calculation but I decided to skip it. Because the implementation and test (like in your example) are absolutely the same parts of code