Crates.io | hamming_rs |
lib.rs | hamming_rs |
version | 0.2.22 |
source | src |
created_at | 2022-04-16 11:13:18.709086 |
updated_at | 2024-02-03 13:46:23.035342 |
description | Computes Hamming distance and weight -- if available, uses a highly optimized avx2 implementation |
homepage | https://github.com/JeWaVe/hamming_rs |
repository | https://github.com/JeWaVe/hamming_rs |
max_upload_size | |
id | 568929 |
size | 4,144,402 |
Computes hamming distance and weight, possibly with avx/avx2 instructions for x86 processors
avx2 optimized version is used when inputs have same memory alignment
otherwise, functions will fallback to slower versions
Muła, Wojciech, Nathan Kurz, and Daniel Lemire. "Faster population counts using AVX2 instructions." The Computer Journal 61.1 (2018): 111-120.
https://arxiv.org/pdf/1611.07612.pdf
We ran benchmarks with cargo bench
on a laptop with a Intel core i7-8750H @2.2Ghz with 16Gb of RAM
We compare the avx2 version (with inputs aligned to 256 bytes) against hamming
and strsim
reference crates
We notice a speedup of ~4 against hamming
and of ~100 against strsim