cb-digest

Crates.iocb-digest
lib.rscb-digest
version0.4.0
created_at2025-09-18 11:32:24.843243+00
updated_at2025-09-27 11:38:09.065916+00
descriptionA direct port of the Golang DDSketch implementation.
homepagehttps://github.com/ctrlb-hq/cb-digest
repositoryhttps://github.com/ctrlb-hq/cb-digest
max_upload_size
id1844582
size50,099
Adarsh Srivastava (adarshsrivastava11)

documentation

README

cb-digest

This is a direct port of the Golang DDSketch quantile sketch implementation to Rust. DDSketch is a fully-mergeable quantile sketch with relative-error guarantees and is extremely fast.

Based on [mheffner] (https://github.com/mheffner/rust-sketches-ddsketch)

DDSketch

  • Sketch size automatically grows as needed, starting with 128 bins.
  • Extremely fast sample insertion and sketch merges.

Usage

use sketches_ddsketch::{Config, DDSketch};

let config = Config::defaults();
let mut sketch = DDSketch::new(c);

sketch.add(1.0);
sketch.add(1.0);
sketch.add(1.0);

// Get p=50%
let quantile = sketch.quantile(0.5).unwrap();
assert_eq!(quantile, Some(1.0));

Performance

No performance tuning has been done with this implementation of the port, so we would expect similar profiles to the original implementation.

Out of the box we see can achieve over 70M sample inserts/sec and 350K sketch merges/sec. All tests run on a single core Intel i7 processor with 4.2Ghz max clock.

Commit count: 43

cargo fmt