Rust-powered DDSketch for Python
Project description
rddsketch
Python bindings, via PyO3, for
sketches-ddsketch —
a Rust port of DataDog's Go/Java DDSketch
implementations. A near-drop-in, faster replacement for DataDog's official
ddsketch Python package.
Install
pip install rddsketch
Prebuilt wheels (Linux/macOS/Windows, Python 3.11+) via abi3, no Rust
toolchain needed at install time.
Usage
from rddsketch import DDSketch
s = DDSketch(relative_accuracy=0.01) # default: 1% relative error
s.add(12.3)
s.add(45.6)
s.quantile(0.5) # -> float | None
s.count, s.sum, s.min, s.max
s2 = DDSketch(relative_accuracy=0.01)
s2.add(100.0)
s.merge(s2) # in-place, requires matching config
s3 = s.copy()
data = s.to_bytes()
restored = DDSketch.from_bytes(data, relative_accuracy=0.01)
add/quantile/get_quantile_value/merge/count/sum/min/max
match ddsketch.DDSketch directly. Differences: no weight param on
add, constructor args and serialization format differ, avg is an added
convenience property.
Benchmarks
Single-threaded, release build, rddsketch vs. ddsketch:
| n | rddsketch | ddsketch | speedup |
|---|---|---|---|
| 10,000 | 0.001s | 0.012s | 14.9x |
| 100,000 | 0.009s | 0.069s | 7.4x |
| 1,000,000 | 0.084s | 0.642s | 7.6x |
| 10,000,000 | 0.795s | 6.741s | 8.5x |
Quantile accuracy is identical (same algorithm). Memory usage is similar
for a single sketch; for many independent sketches rddsketch uses
meaningfully less. Full numbers and methodology:
benchmarks/results.md.
Design notes
- Algorithm:
sketches-ddsketchdoes the real work; this crate validates inputs and wraps it for Python. - Bin store: dense, collapsing, bounded by
max_num_bins(default 2048, matchingLogCollapsingLowestDenseDDSketch) — not the unboundedddsketch.DDSketch. - Serialization:
to_bytes()/from_bytes()use DataDog's Java-compatible binary encoding unmodified.from_bytes()needsrelative_accuracypassed back in — it can't be recovered from the bytes alone. - No
weightparam: the underlying store counts unweighted.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rddsketch-0.0.1.tar.gz.
File metadata
- Download URL: rddsketch-0.0.1.tar.gz
- Upload date:
- Size: 16.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d831098cd72ef3aaa81f5ceef0ac0f7cca629c3d6e6cdecbf64f0f94d2ba87a0
|
|
| MD5 |
4af175e2b07a65f9542aace379dc58f8
|
|
| BLAKE2b-256 |
e2daeb3d770178b941a603bf39c53bd46f26bab1db002d5fca1f362249a305e6
|
Provenance
The following attestation bundles were made for rddsketch-0.0.1.tar.gz:
Publisher:
release.yml on f4hy/rddsketch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rddsketch-0.0.1.tar.gz -
Subject digest:
d831098cd72ef3aaa81f5ceef0ac0f7cca629c3d6e6cdecbf64f0f94d2ba87a0 - Sigstore transparency entry: 2159251034
- Sigstore integration time:
-
Permalink:
f4hy/rddsketch@e1f8fdbe1d24cd8e7aa01bf59c35983c3f0aea56 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/f4hy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e1f8fdbe1d24cd8e7aa01bf59c35983c3f0aea56 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rddsketch-0.0.1-cp311-abi3-win_amd64.whl.
File metadata
- Download URL: rddsketch-0.0.1-cp311-abi3-win_amd64.whl
- Upload date:
- Size: 150.0 kB
- Tags: CPython 3.11+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db8ef2d5a044527ca4587a696f4e594fb9e00f9ec573e3beebed1b9db9e35f9c
|
|
| MD5 |
7916b7d4e2717045b8060beef0535d79
|
|
| BLAKE2b-256 |
872d65d6efe57a5bcf81a39554ba041a98faea32d281b9ebf43886e5b6d10edd
|
Provenance
The following attestation bundles were made for rddsketch-0.0.1-cp311-abi3-win_amd64.whl:
Publisher:
release.yml on f4hy/rddsketch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rddsketch-0.0.1-cp311-abi3-win_amd64.whl -
Subject digest:
db8ef2d5a044527ca4587a696f4e594fb9e00f9ec573e3beebed1b9db9e35f9c - Sigstore transparency entry: 2159251318
- Sigstore integration time:
-
Permalink:
f4hy/rddsketch@e1f8fdbe1d24cd8e7aa01bf59c35983c3f0aea56 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/f4hy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e1f8fdbe1d24cd8e7aa01bf59c35983c3f0aea56 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rddsketch-0.0.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: rddsketch-0.0.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 291.0 kB
- Tags: CPython 3.11+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
006c07d4efe41926d4cc4844974b7d4b2779d00cdad2ff8a27bbe5977cd8d688
|
|
| MD5 |
4cc8d92c828807ca21fc09c09b64253f
|
|
| BLAKE2b-256 |
9558dcea3c029e5e969ca7f35e9d13ec2cf3e9d7bcab58921c14181354ce8725
|
Provenance
The following attestation bundles were made for rddsketch-0.0.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on f4hy/rddsketch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rddsketch-0.0.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
006c07d4efe41926d4cc4844974b7d4b2779d00cdad2ff8a27bbe5977cd8d688 - Sigstore transparency entry: 2159251485
- Sigstore integration time:
-
Permalink:
f4hy/rddsketch@e1f8fdbe1d24cd8e7aa01bf59c35983c3f0aea56 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/f4hy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e1f8fdbe1d24cd8e7aa01bf59c35983c3f0aea56 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rddsketch-0.0.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: rddsketch-0.0.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 287.2 kB
- Tags: CPython 3.11+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c70c59e1e94ff649fc54f50e90d4d79aae998fbe84563652c47c09f0ff16232
|
|
| MD5 |
dee5b4b5bded3492d4763ccabffeaf72
|
|
| BLAKE2b-256 |
93e1a10a9ed1b392d089737932c1b06178266f2c4cb42389917ec0c549770570
|
Provenance
The following attestation bundles were made for rddsketch-0.0.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on f4hy/rddsketch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rddsketch-0.0.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
0c70c59e1e94ff649fc54f50e90d4d79aae998fbe84563652c47c09f0ff16232 - Sigstore transparency entry: 2159251243
- Sigstore integration time:
-
Permalink:
f4hy/rddsketch@e1f8fdbe1d24cd8e7aa01bf59c35983c3f0aea56 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/f4hy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e1f8fdbe1d24cd8e7aa01bf59c35983c3f0aea56 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rddsketch-0.0.1-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: rddsketch-0.0.1-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 257.5 kB
- Tags: CPython 3.11+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
493a360dd1831eef28d9c8bda9f5f46dd3eff16a84ae97383743da8ada059b24
|
|
| MD5 |
86a8778ab6b8a4318deeeb4aeaf5d59f
|
|
| BLAKE2b-256 |
c47abca267281669c7fc675b2a1050e3f7a7a17ae73d2939a80098ba310de253
|
Provenance
The following attestation bundles were made for rddsketch-0.0.1-cp311-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on f4hy/rddsketch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rddsketch-0.0.1-cp311-abi3-macosx_11_0_arm64.whl -
Subject digest:
493a360dd1831eef28d9c8bda9f5f46dd3eff16a84ae97383743da8ada059b24 - Sigstore transparency entry: 2159251121
- Sigstore integration time:
-
Permalink:
f4hy/rddsketch@e1f8fdbe1d24cd8e7aa01bf59c35983c3f0aea56 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/f4hy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e1f8fdbe1d24cd8e7aa01bf59c35983c3f0aea56 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rddsketch-0.0.1-cp311-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: rddsketch-0.0.1-cp311-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 255.7 kB
- Tags: CPython 3.11+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7011d69a4a869a8fa17c6444ca2c4f5f32e95911cf4d05650c2c28ae1e4e5905
|
|
| MD5 |
ead30b5cb62bded65d1a834efb0f4245
|
|
| BLAKE2b-256 |
e75c21a0e1cb35b32ad3e5dc2a5d6b233ee10ccac6523acfa3f15957e73753cf
|
Provenance
The following attestation bundles were made for rddsketch-0.0.1-cp311-abi3-macosx_10_12_x86_64.whl:
Publisher:
release.yml on f4hy/rddsketch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rddsketch-0.0.1-cp311-abi3-macosx_10_12_x86_64.whl -
Subject digest:
7011d69a4a869a8fa17c6444ca2c4f5f32e95911cf4d05650c2c28ae1e4e5905 - Sigstore transparency entry: 2159251399
- Sigstore integration time:
-
Permalink:
f4hy/rddsketch@e1f8fdbe1d24cd8e7aa01bf59c35983c3f0aea56 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/f4hy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e1f8fdbe1d24cd8e7aa01bf59c35983c3f0aea56 -
Trigger Event:
push
-
Statement type: