[package]
name = "subms-hyperloglog"
version = "0.5.2"
edition = "2024"
rust-version = "1.85"
authors = ["Kieran Smith <oss@submillisecond.com>"]
description = "submillisecond.com cookbook recipe - data-structures: subms-hyperloglog. Distinct-count cardinality estimator. ~1% standard error at ~16 KB."
license = "MIT OR Apache-2.0"
readme = "README.md"
homepage = "https://submillisecond.com/cookbook/recipes/subms-hyperloglog"
keywords = ["hyperloglog", "cardinality", "probabilistic", "subms"]
categories = ["data-structures", "algorithms"]

[lib]
name = "subms_hyperloglog"
path = "src/lib.rs"

[[example]]
name = "perf_main"
required-features = ["harness"]

[[example]]
name = "perf_features"
required-features = ["harness", "sparse", "union-intersect"]

[features]
default = []

# Bench-harness wiring: `Recipe` impl, perf_main example, sub-ms bench.
harness = ["dep:subms"]

# ----- Opt-in feature catalog (subms 0.5+) -----
# Each feature lives in src/features/<name>.rs behind a #[cfg(feature)]
# gate. Base HLL is zero-dep std-only; opt-ins add focused capability.
#
#   subms-hyperloglog = { version = "0.5", features = ["sparse"] }
#
# `sparse`          - SparseHLL: <(idx, r)> list encoding for low
#                     cardinality. Promotes to dense at threshold so
#                     long-running streams converge to the base shape.
#                     ~80 B at 0 distinct, growing linearly to ~16 KB.
# `union-intersect` - estimate_union() / estimate_intersect() free
#                     functions for set ops via inclusion-exclusion.
# `serde`           - Serde derive on HLL and feature types. Pulls in
#                     the serde crate.
sparse = []
union-intersect = []
serde = ["dep:serde"]

[dependencies]
subms = { version = "0.5.2", path = "../../../../subms/rust", optional = true }
serde = { version = "1", optional = true, features = ["derive"] }
