Home▸Algorithms & AI▸HyperLogLog Cardinality Lab (2D)

HyperLogLog Cardinality Lab (2D)

2D companion to the HyperLogLog simulator: a real murmur-style hash routes a live item stream into registers, each keeping only its longest leading-zero run, while a harmonic-mean estimator reconstructs the true distinct count from a few kilobytes of state.

Algorithms & AI2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-hyperloglog-cardinality-lab ↗ Open standalone

This 2D companion runs the same real HyperLogLog math as the 3D version — a murmur-style avalanching hash, per-bucket leading-zero-run registers, and the harmonic-mean estimator with small-range linear-counting correction — through a flat grid of registers instead of an orbiting 3D scene: watch items stream in and land in their bucket, brighten a register only when they set a new longest run, and compare the live estimate against the true distinct count as you change the bucket count or how often the stream repeats old items.

⚙ Under the hood

2D HyperLogLog lab: a real murmur-style hash routes items into registers tracking the longest leading-zero run per bucket, and a harmonic-mean estimator with small-range correction reconstructs the distinct count live.

hyperloglogcardinality-estimationprobabilistic-algorithmsdata-structureshashingstreaming-algorithms

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)