Repository navigation
docs(design): zsync hash-layout decision record (compact keys) - #3643
Merged
Merged
Conversation
Add ADR for the fourth zsync-inspired matching insertion point: in-memory layout of the rolling-checksum lookup map. Records three options (keep FxHashMap, sorted-vec binary search, open-addressed table), benchmark- driven decision criteria gated on #2073 cachegrind data, cache-behaviour reasoning across L1/L2/L3 working sets, and the wire-compat invariants (zero wire impact under any option). Recommendation: defer pending #2073; keep Option A as default unless cache-miss gain exceeds 15% or wall-clock gain exceeds 10% on the 100 MB-modified benchmark. Refs #2054.
oferchen
added a commit
that referenced
this pull request
May 18, 2026
Add ADR for the fourth zsync-inspired matching insertion point: in-memory layout of the rolling-checksum lookup map. Records three options (keep FxHashMap, sorted-vec binary search, open-addressed table), benchmark- driven decision criteria gated on #2073 cachegrind data, cache-behaviour reasoning across L1/L2/L3 working sets, and the wire-compat invariants (zero wire impact under any option). Recommendation: defer pending #2073; keep Option A as default unless cache-miss gain exceeds 15% or wall-clock gain exceeds 10% on the 100 MB-modified benchmark. Refs #2054.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
Add ADR for the fourth zsync-inspired matching insertion point: in-memory layout of the rolling-checksum lookup map. Records three options (keep FxHashMap, sorted-vec binary search, open-addressed table), benchmark- driven decision criteria gated on #2073 cachegrind data, cache-behaviour reasoning across L1/L2/L3 working sets, and the wire-compat invariants (zero wire impact under any option). Recommendation: defer pending #2073; keep Option A as default unless cache-miss gain exceeds 15% or wall-clock gain exceeds 10% on the 100 MB-modified benchmark. Refs #2054.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Recommendation
Defer pending #2073 cachegrind data; keep Option A (current FxHashMap) as the default unless the prototype shows >15% L1-data miss reduction or >10% wall-clock speedup on the 100 MB-modified benchmark.
Summary
Adds an ADR for the fourth zsync-inspired matching insertion point: the in-memory layout of the rolling-checksum lookup map in
crates/match/src/index/mod.rs. Scopes the keep-or-drop decision for the compact-keys prototype (#2072) and its bench (#2073) without touching code.Options considered
FxHashMap<(u16, u16), Vec<usize>>(today's code).Vec<(u32, u32)>sorted byrsum_low, binary search.The ADR walks each option's footprint, per-hit and per-miss cost, and L1/L2/L3 cache behaviour at 1 K, 100 K, and 1 M block counts, and ties the decision to concrete numeric thresholds from #2073.
Wire-compat invariants - all green
This is a purely in-memory layout decision. Every option preserves byte-identical output against upstream rsync 3.0.9 / 3.1.3 / 3.4.1 in both directions:
crates/protocol/tests/golden/byte goldens stay green.tools/ci/run_interop.shproduces no new entries intools/ci/known_failures.conf.crates/cli/.crates/protocolchange beyond internal API plumbing.match::indexsurface (find_match_bytes,find_match_slices) keeps current signatures.Risk if dropped
Bithash (#2059), seq-match (#2064), and prune (#2068) are independent and additive; compact keys can be deferred indefinitely without blocking any of the other three. The decision is reversible and gated on benchmark evidence.
Test plan
docs/design/.Refs #2054.