UltraLogLog
Rust implementation of the UltraLogLog algorithm. Ultraloglog is more space efficient than the widely used HyperLogLog, but can be slower. FGRA estimator or MLE estimator can be used.
Usage
use ultraloglog::{Estimator, MaximumLikelihoodEstimator, OptimalFGRAEstimator, UltraLogLog};
let mut ull = UltraLogLog::new(6).unwrap();
ull.add_value("apple")
.add_value("banana")
.add_value("cherry")
.add_value("033");
let est = ull.get_distinct_count_estimate();
The serde feature can be activated so that the sketch can be saved to disk and then loaded.
use ultraloglog::{Estimator, MaximumLikelihoodEstimator, OptimalFGRAEstimator, UltraLogLog};
use std::fs::{remove_file, File};
use std::io::{BufReader, BufWriter};
let file_path = "test_ultraloglog.bin";
// Create UltraLogLog and add data
let mut ull = UltraLogLog::new(5).expect("Failed to create ULL");
ull.add(123456789);
ull.add(987654321);
let original_estimate = ull.get_distinct_count_estimate();
// Save to file using writer
let file = File::create(file_path).expect("Failed to create file");
let writer = BufWriter::new(file);
ull.save(writer).expect("Failed to save UltraLogLog");
// Load from file using reader
let file = File::open(file_path).expect("Failed to open file");
let reader = BufReader::new(file);
let loaded_ull = UltraLogLog::load(reader).expect("Failed to load UltraLogLog");
let loaded_estimate = loaded_ull.get_distinct_count_estimate();
Python Bindings
This crate also provides Python bindings for the UltraLogLog algorithm using PyO3. See example.py for usage.
import ultraloglog
# Create a new UltraLogLog sketch
ull = ultraloglog.PyUltraLogLog(12) # precision parameter
# Add values
ull.add_str("hello")
ull.add_int(42)
ull.add_float(3.14)
# Get estimated count
print(f"Estimated distinct count: {ull.count()}")
Installation
Using pip
This package is available as ultraloglog in PyPI. You can install it using:
pip install ultraloglog
From Source
uv is recommended to manage virtual environments.
- Install Rust, and maturin
pip install maturin - Build and install:
maturin develop --release
64-bit hash function
As mentioned in the paper, high quality 64-bit hash function is key to ultraloglog algorithm. We tested several modern 64-bit hash libraries and found that xxhash-rust (default) and wyhash-rs worked well. However, users can easily replace the default xxhash-rust with polymurhash, komihash, ahash and t1ha et.al. See testing section for details.
Reference
Ertl, O., 2024. UltraLogLog: A Practical and More Space-Efficient Alternative to HyperLogLog for Approximate Distinct Counting. Proceedings of the VLDB Endowment, 17(7), pp.1655-1668.
Metadata
Release files for ultraloglog 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 4.1 MB
Release files / ultraloglog-0.1.6-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | ultraloglog-0.1.6-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 291.8 kB |
| Tags | CPython 3.14 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
47db211ebf94ac8d2b93a45a08e2ad22d46b345b754182e0cdefcb616117a5f8
|
|
BLAKE2b-256 checksum How to use checksums |
fa3e33ae3a67ba320b010d8773bc420714c759f55f1b12543a6666a9a97bce85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Release files / ultraloglog-0.1.6-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | ultraloglog-0.1.6-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 258.1 kB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
da88f528011a011e3a381f300116fadca1dfef2d1d475f52c31bcb5d3b6381e3
|
|
BLAKE2b-256 checksum How to use checksums |
3eeb4551c439f81f6f70bbe1673cccd3f099f06446c10d4013fb5f4a14586090
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Release files / ultraloglog-0.1.6-cp314-cp314-macosx_10_12_x86_64.whl
| Download URL | ultraloglog-0.1.6-cp314-cp314-macosx_10_12_x86_64.whl |
|---|---|
| Size | 264.2 kB |
| Tags | CPython 3.14 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
602e5a7f5a6c8e3a2fd485dbedb054eae5ee06c71b869161b3bbcdf3b5b6b5b3
|
|
BLAKE2b-256 checksum How to use checksums |
2675cd30997a1955b69c7d70f944edf4deb599ddaf24e853f5668f000d2800cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Release files / ultraloglog-0.1.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | ultraloglog-0.1.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 292.4 kB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
6ea4f89e2b4f0e146e3dce9435d5adda41f97147929913c50900102dac11effc
|
|
BLAKE2b-256 checksum How to use checksums |
f9ce18865e2f82b75844392a54f37a31678070ae3e443de295c71680c2e278da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Release files / ultraloglog-0.1.6-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | ultraloglog-0.1.6-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 258.9 kB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
3c1a71d2cff5daf490c105a8935dfd639fc78986bf00593d9ca09bf5cd6eea8c
|
|
BLAKE2b-256 checksum How to use checksums |
b4e9ad3d349f31160a6a577560e3f92c54fb01eb8c381250955d53c9b5cdc94c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Release files / ultraloglog-0.1.6-cp313-cp313-macosx_10_12_x86_64.whl
| Download URL | ultraloglog-0.1.6-cp313-cp313-macosx_10_12_x86_64.whl |
|---|---|
| Size | 265.7 kB |
| Tags | CPython 3.13 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
805754be53e75e8a6d7104dfc7fa3c694029a1a94ac0ab8114e6c50cc49c3d0d
|
|
BLAKE2b-256 checksum How to use checksums |
47599d1c602f9ec113fb4b52d5e7832445b4d99fc1adca1042bcfe08336e761f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Release files / ultraloglog-0.1.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | ultraloglog-0.1.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 292.3 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
d1e0ee6178b2aef4db7cbb5975f65c4a9113b841630ad51146172949a3bd1a12
|
|
BLAKE2b-256 checksum How to use checksums |
8f589c52a3d2a1fa374e4da28090f67444b8cb2ff5b5af08328043ef5bdea575
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Release files / ultraloglog-0.1.6-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | ultraloglog-0.1.6-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 259.1 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
8f10cd22aa395119ce8893ce22f1563d87553796684ffce1703948bc1b82f908
|
|
BLAKE2b-256 checksum How to use checksums |
40ea4b943491c822b38416f06ab05fbf181d89b7a35c67df047063d20324282c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Release files / ultraloglog-0.1.6-cp312-cp312-macosx_10_12_x86_64.whl
| Download URL | ultraloglog-0.1.6-cp312-cp312-macosx_10_12_x86_64.whl |
|---|---|
| Size | 265.6 kB |
| Tags | CPython 3.12 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
62d0e72dc64427c63d1edb19bbaa96f9f4b0f6dc32542f448dddfdf96a7eff48
|
|
BLAKE2b-256 checksum How to use checksums |
26a454dd189d7afcdb53ed31b006f6887910f69fcf676f1a0f9bb0f581aaf355
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Release files / ultraloglog-0.1.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | ultraloglog-0.1.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 293.4 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
36a0596945a097218534643cb1d9b401422eafed788ad8bec20b46825cd0faf3
|
|
BLAKE2b-256 checksum How to use checksums |
929e30a7fa85ef123731cc15794ea8f6f354d4a3554ccc831212e5689edbac5e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Release files / ultraloglog-0.1.6-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | ultraloglog-0.1.6-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 259.0 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
dd0b345bce6f03e78565a198f832c5b28f294c6599df0aef8a353a98ba2b2c0d
|
|
BLAKE2b-256 checksum How to use checksums |
3a1426c77989492e220f50b14286cdc69389853c77874589394dc28585d4ee10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Release files / ultraloglog-0.1.6-cp311-cp311-macosx_10_12_x86_64.whl
| Download URL | ultraloglog-0.1.6-cp311-cp311-macosx_10_12_x86_64.whl |
|---|---|
| Size | 265.2 kB |
| Tags | CPython 3.11 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
172340b427fc11e570c2f31f3f70d1f0877131952d1c2945426b366e89e172c0
|
|
BLAKE2b-256 checksum How to use checksums |
29fae469d68edf9a1c16093eadc5cab8ef0a614ecc5069e03a33937d9ffa9f43
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Release files / ultraloglog-0.1.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | ultraloglog-0.1.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 293.7 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
0f394ae5d6e0ac9fc53752eba8fc2276da904b1ad55d218bcaa6257b86661640
|
|
BLAKE2b-256 checksum How to use checksums |
0446327b32c107119dab4bc0a303eba7be6ab66ca732de66fa03642ad028fc7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Release files / ultraloglog-0.1.6-cp310-cp310-macosx_11_0_arm64.whl
| Download URL | ultraloglog-0.1.6-cp310-cp310-macosx_11_0_arm64.whl |
|---|---|
| Size | 259.2 kB |
| Tags | CPython 3.10 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ad49d79a2eba8786e9454258eda0a9ebe69efab21be3a2e446d9e04c25d7f461
|
|
BLAKE2b-256 checksum How to use checksums |
537b2b72e4eb01483884f65e3e35b555327939140a1072d3c7acc35258cbb198
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Release files / ultraloglog-0.1.6-cp310-cp310-macosx_10_12_x86_64.whl
| Download URL | ultraloglog-0.1.6-cp310-cp310-macosx_10_12_x86_64.whl |
|---|---|
| Size | 265.4 kB |
| Tags | CPython 3.10 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
7f3a3f08fa3f256ef4ee7bf81f46729575451027864f17c9c68cdec07107f5da
|
|
BLAKE2b-256 checksum How to use checksums |
a01f32f557f83b037bb324204b456cbff2efe600acd817ba593b5de58801a0f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Security for ultraloglog 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.