Crates.io | sketches-ddsketch |
lib.rs | sketches-ddsketch |
version | 0.3.0 |
source | src |
created_at | 2019-09-19 23:09:14.750114 |
updated_at | 2024-06-01 14:35:46.356351 |
description | A direct port of the Golang DDSketch implementation. |
homepage | https://github.com/mheffner/rust-sketches-ddsketch |
repository | https://github.com/mheffner/rust-sketches-ddsketch |
max_upload_size | |
id | 166092 |
size | 47,596 |
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.
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));
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.