oconnor663 / blake2_simd

high-performance implementations of BLAKE2b/s/bp/sp in pure Rust with dynamic SIMD
MIT License
126 stars 22 forks source link

remove the dependency on byteorder #5

Closed oconnor663 closed 6 years ago

oconnor663 commented 6 years ago

Since that crate takes slices in its API, it tends to introduce unnecessary bounds checks.

oconnor663 commented 6 years ago

This removes a dependency and slightly improves the performance of the portable implementation. But we can't land it until https://github.com/rust-lang/rust/issues/52963 is stable, unless we want to copy those unsafe functions into the crate.

oconnor663 commented 6 years ago

Notably, with the slight performance improvement in this PR, our b2sum hardcoded to use portable.rs edges past the coreutils b2sum in performance.

oconnor663 commented 6 years ago

Actually it turns out that the slight performance drag was entirely due to read_u64_into, and unrolling that loop improves it, without needing to remove the byteorder dependency. I'm going to land some of that now, and we can drop this PR. The to_le_bytes API will be nice, but I think at least in this case it's going to compile to the same code as byteorder.