Bzip2 crate switches from C to 100% rust
a year ago
- #bzip2
- #Rust
- #performance
- bzip2 crate version 0.6.0 now uses a Rust implementation (libbz2-rs-sys) by default, improving performance and cross-compilation.
- The Rust implementation generally outperforms the C version, especially in compression, with significant speedups.
- Cross-compilation is simplified with the Rust implementation, eliminating issues with C dependencies, especially for WebAssembly, Windows, and Android.
- Symbols are not exported by default in libbz2-rs-sys, preventing conflicts with other dependencies, though a feature flag allows exporting if needed.
- The Rust implementation allows running tests with MIRI, enabling safer use of unsafe code and higher-level libraries.
- An audit found one logic bug (off-by-one error) and improved the fuzzer, with no other significant issues.
- The update is a maintenance win, making the bzip2 crate faster and easier to use without needing to think about underlying complexities.