English

HyperLogLogLog: Cardinality Estimation With One Log More

Data Structures and Algorithms 2022-05-24 v1

Abstract

We present HyperLogLogLog, a practical compression of the HyperLogLog sketch that compresses the sketch from O(mloglogn)O(m\log\log n) bits down to mlog2log2log2m+O(m+loglogn)m \log_2\log_2\log_2 m + O(m+\log\log n) bits for estimating the number of distinct elements~nn using mm~registers. The algorithm works as a drop-in replacement that preserves all estimation properties of the HyperLogLog sketch, it is possible to convert back and forth between the compressed and uncompressed representations, and the compressed sketch maintains mergeability in the compressed domain. The compressed sketch can be updated in amortized constant time, assuming nn is sufficiently larger than mm. We provide a C++ implementation of the sketch, and show by experimental evaluation against well-known implementations by Google and Apache that our implementation provides small sketches while maintaining competitive update and merge times. Concretely, we observed approximately a 40% reduction in the sketch size. Furthermore, we obtain as a corollary a theoretical algorithm that compresses the sketch down to mlog2log2log2log2m+O(mlogloglogm/loglogm+loglogn)m\log_2\log_2\log_2\log_2 m+O(m\log\log\log m/\log\log m+\log\log n) bits.

Cite

@article{arxiv.2205.11327,
  title  = {HyperLogLogLog: Cardinality Estimation With One Log More},
  author = {Matti Karppa and Rasmus Pagh},
  journal= {arXiv preprint arXiv:2205.11327},
  year   = {2022}
}

Comments

10 pages, 7 figures, KDD '22

R2 v1 2026-06-24T11:25:43.069Z