| Crates.io | hypeerlog |
| lib.rs | hypeerlog |
| version | 0.2.6 |
| created_at | 2025-07-22 22:23:04.053811+00 |
| updated_at | 2025-09-23 04:29:12.094289+00 |
| description | A fast, distributable, and lightweight HyperLogLog implementation with bias correction |
| homepage | |
| repository | https://github.com/Albassel/hypeerlog |
| max_upload_size | |
| id | 1764135 |
| size | 48,407 |
A fast, distributable, and lightweight HyperLogLog implementation with bias correction
use hypeerlog::Hypeerlog;
let elems = vec![1, 2, 3, 4, 5, 6, 7, 1, 1, 2];
let mut hll = Hypeerlog::new();
hll.insert_many(&elems);
// Should be within 1% of the real cardinality
hll.cardinality();
You can divide the dataset onto multiple computers, dump the hll when you finish adding the data, load the dump into another computer, merge all the hll, and then calculate the cardinality of the merged hll to get the cardinality for the whole dataset:
use hypeerlog::Hypeerlog;
let elems = vec![1, 2, 3, 4, 5, 6, 7, 1, 1, 2];
let mut hll_one = Hypeerlog::new();
hll_one.insert_many(&elems[0..5]);
let mut hll_two = Hypeerlog::new();
hll_two.insert_many(&elems[5..]);
hll_one.merge(hll_two).unwrap().cardinality();
Feel free to fork or do a pull request, but it is highly advised to read the Google paper before looking into the code in order to understand the internals