Zillowe FoundationZillowe Documentation

Parallelization

Speed up patch creation with multi-threaded diffing.

zbsdiff supports several parallelization schemes to speed up the patch generation process.

Parallel Schemes

You can configure the parallelization scheme using Bsdiff::parallel_scheme.

use zbsdiff::{Bsdiff, ParallelScheme};

let bsdiff = Bsdiff::new(source, target)
    .parallel_scheme(ParallelScheme::Auto);

Available Variants

  • Never: Single-threaded search. Best for very small files.
  • Auto: Automatically chooses a reasonable chunk size for parallelization.
  • ChunkSize(usize): Splits the target into fixed-size chunks.
  • NumJobs(usize): Divides the target into a fixed number of jobs.
  • Cdc(usize): Uses Content-Defined Chunking (CDC) to split the target.

Content-Defined Chunking (CDC)

CDC is an advanced parallelization strategy that uses a sliding window hash (Gear hash) to find natural boundaries in the data. Unlike fixed-size chunking, CDC is resilient to insertions and deletions, which can lead to better patch quality in multi-threaded mode.

To use CDC, provide the desired average chunk size:

use zbsdiff::{Bsdiff, ParallelScheme};

let bsdiff = Bsdiff::new(source, target)
    .parallel_scheme(ParallelScheme::Cdc(512 * 1024)); // 512 KiB avg chunks

A software organization

2026 © All Rights Reserved.

  • All the content is available under CC BY-SA 4.0, expect where otherwise stated.

Last updated on