| Crates.io | hamming-bitwise-fast |
| lib.rs | hamming-bitwise-fast |
| version | 1.0.0 |
| created_at | 2024-12-20 15:20:30.918711+00 |
| updated_at | 2024-12-20 15:20:30.918711+00 |
| description | A fast, zero-dependency implementation of bitwise Hamming Distance using a method amenable to auto-vectorization. |
| homepage | |
| repository | https://github.com/emschwartz/hamming-bitwise-fast |
| max_upload_size | |
| id | 1490278 |
| size | 1,130,765 |
A fast, zero-dependency implementation of bitwise Hamming Distance using a method amenable to auto-vectorization.
This started out as a benchmark of various bitwise Hamming distance implementations in Rust. However, after finding that a simple implementation that is amenable to auto-vectorization was comparable, if not faster, than other implementations, I decided to publish it as a crate.
Note: This is for comparing bit-vectors, not for comparing strings.
use hamming_bitwise_fast::hamming_bitwise_fast;
assert_eq!(hamming_bitwise_fast(&[0xFF; 1024], &[0xFF; 1024]), 0);
assert_eq!(hamming_bitwise_fast(&[0xFF; 1024], &[0x00; 1024]), 1024);
This uses Criterion to benchmark various Hamming distance implementations:
hamming hamming_rs simsimd cargo bench
Then open the target/criterion/report/index.html file in your browser to view the results.
These were the results running on 3 different types of machines:
This project is licensed under either of the following licenses, at your option:
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.