Skip to main content

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-ddsketch does the real work; this crate validates inputs and wraps it for Python.
  • Bin store: dense, collapsing, bounded by max_num_bins (default 2048, matching LogCollapsingLowestDenseDDSketch) — not the unbounded ddsketch.DDSketch.
  • Serialization: to_bytes()/from_bytes() use DataDog's Java-compatible binary encoding unmodified. from_bytes() needs relative_accuracy passed back in — it can't be recovered from the bytes alone.
  • No weight param: the underlying store counts unweighted.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rddsketch-0.0.1.tar.gz (16.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rddsketch-0.0.1-cp311-abi3-win_amd64.whl (150.0 kB view details)

Uploaded CPython 3.11+Windows x86-64

rddsketch-0.0.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (291.0 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

rddsketch-0.0.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (287.2 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

rddsketch-0.0.1-cp311-abi3-macosx_11_0_arm64.whl (257.5 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

rddsketch-0.0.1-cp311-abi3-macosx_10_12_x86_64.whl (255.7 kB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

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

Hashes for rddsketch-0.0.1.tar.gz
Algorithm Hash digest
SHA256 d831098cd72ef3aaa81f5ceef0ac0f7cca629c3d6e6cdecbf64f0f94d2ba87a0
MD5 4af175e2b07a65f9542aace379dc58f8
BLAKE2b-256 e2daeb3d770178b941a603bf39c53bd46f26bab1db002d5fca1f362249a305e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for rddsketch-0.0.1.tar.gz:

Publisher: release.yml on f4hy/rddsketch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for rddsketch-0.0.1-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 db8ef2d5a044527ca4587a696f4e594fb9e00f9ec573e3beebed1b9db9e35f9c
MD5 7916b7d4e2717045b8060beef0535d79
BLAKE2b-256 872d65d6efe57a5bcf81a39554ba041a98faea32d281b9ebf43886e5b6d10edd

See more details on using hashes here.

Provenance

The following attestation bundles were made for rddsketch-0.0.1-cp311-abi3-win_amd64.whl:

Publisher: release.yml on f4hy/rddsketch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rddsketch-0.0.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rddsketch-0.0.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 006c07d4efe41926d4cc4844974b7d4b2779d00cdad2ff8a27bbe5977cd8d688
MD5 4cc8d92c828807ca21fc09c09b64253f
BLAKE2b-256 9558dcea3c029e5e969ca7f35e9d13ec2cf3e9d7bcab58921c14181354ce8725

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rddsketch-0.0.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rddsketch-0.0.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0c70c59e1e94ff649fc54f50e90d4d79aae998fbe84563652c47c09f0ff16232
MD5 dee5b4b5bded3492d4763ccabffeaf72
BLAKE2b-256 93e1a10a9ed1b392d089737932c1b06178266f2c4cb42389917ec0c549770570

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rddsketch-0.0.1-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rddsketch-0.0.1-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 493a360dd1831eef28d9c8bda9f5f46dd3eff16a84ae97383743da8ada059b24
MD5 86a8778ab6b8a4318deeeb4aeaf5d59f
BLAKE2b-256 c47abca267281669c7fc675b2a1050e3f7a7a17ae73d2939a80098ba310de253

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rddsketch-0.0.1-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rddsketch-0.0.1-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7011d69a4a869a8fa17c6444ca2c4f5f32e95911cf4d05650c2c28ae1e4e5905
MD5 ead30b5cb62bded65d1a834efb0f4245
BLAKE2b-256 e75c21a0e1cb35b32ad3e5dc2a5d6b233ee10ccac6523acfa3f15957e73753cf

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page