Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mrcroxx/cmsketch-rs
A count min sketch implementation for Rust.
https://github.com/mrcroxx/cmsketch-rs
Last synced: 17 days ago
JSON representation
A count min sketch implementation for Rust.
- Host: GitHub
- URL: https://github.com/mrcroxx/cmsketch-rs
- Owner: MrCroxx
- Created: 2023-05-17T08:37:01.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-20T04:01:31.000Z (3 months ago)
- Last Synced: 2024-10-14T17:32:02.254Z (about 1 month ago)
- Language: Rust
- Size: 20.5 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cmsketch
A count min sketch implementation in Rust.
Inspired by [Facebook/CacheLib](https://github.com/facebook/cachelib) and [Caffeine](https://github.com/ben-manes/caffeine).
## Usage
```rust
use cmsketch::CMSketchU32;const ERROR: f64 = 0.01;
const CONFIDENCE: f64 = 0.95;fn main() {
let mut cms = CMSketchU32::new(ERROR, CONFIDENCE);
for i in 0..10 {
for _ in 0..i {
cms.inc(i);
}
}
for i in 0..10 {
assert!(cms.estimate(i) >= i as u32);
}
cms.halve();
for i in 0..10 {
assert!(cms.estimate(i) >= (i as f64 * 0.5) as u32);
}
}
```## Roadmap
- [ ] simd halve
- [ ] benchmark