Skip to content

Delta wire-format: pack HLL delta + add CountMin hh_keys#61

Merged
zzylol merged 1 commit into
mainfrom
asapskl-delta-wire-format
May 26, 2026
Merged

Delta wire-format: pack HLL delta + add CountMin hh_keys#61
zzylol merged 1 commit into
mainfrom
asapskl-delta-wire-format

Conversation

@zzylol

@zzylol zzylol commented May 26, 2026

Copy link
Copy Markdown
Contributor

Two sketch delta encoding updates. Both are verified for cross-language byte parity via golden tests, and neither changes default behavior (delta transmission is opt-in; an unset hh_keys is byte-identical to before).

HLL — pack delta as a varint blob

HLLDelta { repeated HLLRegisterUpdate }HLLDelta { bytes packed_updates }: the increased registers are varint-packed as (index_delta, value) pairs in ascending index order — the same layout HLLSparseRegisters.packed already uses for full sparse state. This removes the per-register sub-message tag/length overhead: a 50-register delta drops from 350 B to 132 B (~62%), and a single-emit delta is about the size of the full sparse frame.

CountMin — add optional hh_keys

CountMinDelta gains hh_keys (repeated string, field 6), matching CountSketchDelta's layout so the two delta encodings are structurally identical. Population is control-plane-gated: it stays empty unless a heavy-hitter source is supplied, so the bytes are unchanged when unset. (CountMin has no Space-Saving tracker, so this adds the field + the decode path, not a forced tracker.)

Tests

cargo test --lib: 426 passed, 0 failed. New test_hh_keys_matches_go_golden_bytes parity guards in both the CountMin and CountSketch modules; existing golden/round-trip tests unchanged.

🤖 Generated with Claude Code

Two delta encoding updates (cross-language byte parity verified via golden
tests against the Go reference implementation):

- HLL: replace HLLDelta's repeated per-register sub-messages with a packed
  varint (index_delta, value) blob — the layout HLLSparseRegisters.packed
  already uses for full sparse state. ~62% smaller deltas; a single-emit
  delta is about the size of the full sparse frame.
- CountMin: add an optional hh_keys (repeated string, field 6) to CountMinDelta
  so it matches CountSketchDelta. Population is control-plane-gated (empty
  unless a heavy-hitter source is supplied); no byte change when unset.

cargo test --lib: 426 passed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@zzylol zzylol force-pushed the asapskl-delta-wire-format branch from 29a0868 to 9289505 Compare May 26, 2026 20:02
@zzylol zzylol merged commit fc9e27a into main May 26, 2026
3 checks passed
@zzylol zzylol deleted the asapskl-delta-wire-format branch May 26, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant