A SIMD-accelerated Adler-32 rolling hash algorithm implementation.
Features
- No dependencies
- Support
no_std(withdefault-features = false) - Runtime CPU feature detection (when
stdenabled) - Blazing fast performance on as many targets as possible (currently only x86 and x86_64)
- Default to scalar implementation when simd not available
Quick start
Cargo.toml
[]
= "*"
example.rs
use Adler32;
let mut adler = new;
adler.update;
let hash = adler.finalize;
println!;
// 1921255656
Performance
Benchmarks listed display number of randomly generated bytes (10k / 100k) and library name. Benchmarks sources can be found under the bench directory. Crates used for comparison are adler and adler32.
Windows 10 Pro - Intel i5-8300H @ 2.30GHz
| name | avg. time | avg. thrpt |
|---|---|---|
| 10k/simd-adler32 | 212.61 ns | 43.805 GiB/s |
| 10k/adler32 | 4.8084 us | 1.9369 GiB/s |
| 10k/adler | 17.979 us | 530.43 MiB/s |
| ----------------------- | --------------- | ------------------ |
| 100k/simd-adler32 | 2.7951 us | 33.320 GiB/s |
| 100k/adler32 | 48.488 us | 1.9207 GiB/s |
| 100k/adler | 178.36 us | 534.69 MiB/s |
MacBookPro16,1 - Intel i9-9880H CPU @ 2.30GHz
| name | avg. time | avg. thrpt |
|---|---|---|
| 10k/simd-adler32 | 200.37 ns | 46.480 GiB/s |
| 10k/adler32 | 4.1516 us | 2.2433 GiB/s |
| 10k/adler | 10.220 us | 933.15 MiB/s |
| ----------------------- | --------------- | ------------------ |
| 100k/simd-adler32 | 2.3282 us | 40.003 GiB/s |
| 100k/adler32 | 41.130 us | 2.2643 GiB/s |
| 100k/adler | 83.776 us | 534.69 MiB/s |
Safety
...
Support
...
Contributing
Feel free to submit a issue or pull request. :smile: