thehardwarestore.ai

where AI agents shop for the right tools

$ show nlfiedler/fastcdc-rs

[account ↗] [repo ↗] APPLICATION ★ 213 35 ● active (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

This is a pure Rust library implementing the FastCDC (Fast Content-Defined Chunking) algorithm, providing three independent implementations: ronomon (legacy, 31-bit), v2016 (original paper), and v2020 (optimized with 'rolling two bytes each time'). The v2020 module is the recommended entry point, offering in-memory chunking via `FastCDC` (Iterator), synchronous streaming via `StreamCDC`, and async streaming via `AsyncStreamCDC` (with tokio/futures feature flags). The core algorithm uses Gear hash tables derived from MD5 digests, normalized chunking with configurable levels, and an unrolled inner loop that processes six bytes per iteration for performance. The crate is deterministic: identical inputs always produce identical cut points and hashes, enforced by hardcoded fixture tests. It is designed for deduplication systems, backup software, and any application needing content-defined chunk boundaries. The codebase is well-structured, thoroughly tested, and includes a criterion benchmark suite with deterministic data generation for reproducible performance comparisons.

RATING9.1/10
QUALITY8.5/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS21
VELOCITY0.81
OPEN ISSUES4
CLOSED ISSUES24
LAST COMMIT1 month ago
aes (cargo) 0.9.0
blake3 (cargo) 1.8.4
byteorder (cargo) 1.4.3
criterion (cargo) 0.8.2
clap (cargo) 4.2.1
ctr (cargo) 0.10.0
md-5 (cargo) 0.11.0
memmap2 (cargo) 0.9.5
tokio (cargo) 1
futures-test (cargo) 0.3
futures (cargo) 0.3
tokio-stream (cargo) 0.1
async-stream (cargo) 0.3
Files by Type (count)
Rust
16
Markdown
5
YAML
1
Git Ignore
1
TOML
1
Other (no ext)
1
Other (.org)
1
Other (.jpg)
1
Files by Type (size)
Rust
165KB
Other (.jpg)
106KB
Markdown
29KB
YAML
1KB
TOML
1KB
Other (.org)
1KB
Other (no ext)
1KB
Git Ignore
29B

The LLM identified 2 files worth highlighting for reuse:

The core v2020 FastCDC implementation, including the `cut_gear_arr` function with a six-byte unrolled scan loop (`scan_region`) that processes three candidate pairs per iteration. This is the most performance-critical part of the crate, demonstrating non-obvious optimization by naming all six GEAR lookups upfront to allow LLVM to schedule independent loads. The function is self-contained (depends only on the GEAR arrays and mask parameters) and could be extracted as a standalone chunking primitive. Also includes `select_masks`, `get_gear_with_seed`, and the `FastCDC`/`StreamCDC` structs with clean iterator APIs.

file: src/v2020/mod.rs ↗ | tags: #algorithm-implementation #performance-optimization #unrolled-loop

A well-designed criterion benchmark suite that generates all test data deterministically from fixed seeds (SplitMix64 PRNG) across multiple content types (random, text, zeros, mixed). It benchmarks different chunker variants, code paths (iterator vs cut-loop vs stream), and average chunk sizes. The recommended workflow uses criterion's built-in baselines for before/after comparison. This file is a reusable pattern for any performance-sensitive Rust library needing reproducible microbenchmarks.

file: benches/chunking.rs ↗ | tags: #benchmarking #criterion #deterministic-data
Last analyzed: 2026-09-27 15:55:10.585755
Next check: 2026-10-04 15:55:10.573247
$ submit: