Introducing bidiff
, a powerful Rust library for generating and applying binary patches. Designed for software updates, it offers efficient memory use, supports large files, and is compatible with multiple compression formats. With rigorous fuzz testing and 100% safe Rust code, bidiff
ensures reliable performance while minimizing update sizes.
bidiff
is an innovative set of Rust crates designed to generate and apply patches for arbitrary binary files, offering significant advantages for software deployment and updates. Built entirely in safe Rust, bidiff
emphasizes safety, performance, and low resource consumption, while also supporting large inputs exceeding 2 GiB and incorporating multiple compression formats like Brotli and Zstandard through the comde crate.
Key Features:
- 100% Safe Rust: Ensures memory safety and concurrency without sacrificing performance.
- Extensive Fuzzing: Thorough testing strengthens security and reliability.
- Efficient Memory Usage: Designed to minimize resource consumption for optimal performance.
- Large File Support: Seamlessly manages patches for files over 2 GiB.
- Multiple Compression Options: Choose from various advanced compression methods for efficient patching.
Performance Benchmarks:
bidiff
has demonstrated superior performance when generating patch files compared to traditional methods like zstd
. Below are benchmark results showcasing the efficiency and speed of bidiff
against popular software sources:
Older | Newer | Newer Size | Naive Size | Naive Time | Bidiff Size | Bidiff Time |
---|---|---|---|---|---|---|
Wine 4.18 sources | 4.19 sources | 201 MiB | 21.96 MiB | 81.300s | 182.26 KiB | 5.220s |
Linux 5.3.13 sources | 5.4 sources | 894.68 MiB | 106.73 MiB | 448.145s | 6.14 MiB | 57.799s |
Chromium 78 (build 97) | (build 108) | 257.04 MiB | 79.73 MiB | 116.975s | 12.81 MiB | 158.867s |
Firefox 71 (build 11) | (build 12) | 192.49 MiB | 54.64 MiB | 78.039s | 6.56 MiB | 81.847s |
Repository Structure:
The bidiff
repository comprises three essential crates:
crates/bidiff
: Contains the core diff algorithm with an optional serialization feature.crates/bipatch
: Facilitates the reading and applying of patches generated bybidiff
.crates/bic
: A demonstration command-line interface for utilizing the above functions, utilizingcomde
for compression.
Advanced Algorithm:
Inspired by the bsdiff
algorithm, bidiff
distinguishes itself with efficiency improvements and memory optimizations.
- Suffix Sorting: Utilizes a hand-optimized Rust implementation of the
divsufsort
algorithm for superior performance at reduced memory costs. - Parallel Processing: Capable of parallelizing both the sorting and scanning phases, maximizing resource utilization and enhancing speed during the diff process.
In summary, bidiff
not only matches the high standards set by its predecessors but surpasses them, offering a faster, safer, and more efficient solution for binary file patching. Dive into bidiff
to experience the power of modern Rust programming in practical applications!