Repository navigation
bench(matching): compact-keys cache behavior across L1/L2/LLC sizes (#2073) - #4188
Merged
Merged
Conversation
oferchen
force-pushed
the
bench/zsync-compact-keys-cache-2073
branch
2 times, most recently
from
May 16, 2026 22:08
185ed9e to
174d81f
Compare
…2073) Adds a Criterion bench that profiles DeltaSignatureIndex's compact lookup table at index sizes spanning L1 (~32 KiB), L2 (~512 KiB), LLC (~32 MiB), and main memory (~256 MiB), with sequential and scattered probe access patterns. The bench supplies the evidence needed to decide whether a packed (rsum_low | bucket_idx) layout (#2072) would meaningfully improve cache behavior over the current 8-byte slot layout. Top-of-file comments document the perf stat and cachegrind invocations and the favorable / unfavorable thresholds that should inform the decision. Production code is unchanged. The bench-internal feature gains three read-only accessors on DeltaSignatureIndex (lookup_capacity, lookup_bytes, lookup_probe) so the bench can isolate the open- addressed probe chain from the surrounding match pipeline.
oferchen
force-pushed
the
bench/zsync-compact-keys-cache-2073
branch
from
May 16, 2026 22:30
174d81f to
9329061
Compare
oferchen
added a commit
that referenced
this pull request
May 18, 2026
…2073) (#4188) * bench(matching): compact-keys cache behavior across L1/L2/LLC sizes (#2073) Adds a Criterion bench that profiles DeltaSignatureIndex's compact lookup table at index sizes spanning L1 (~32 KiB), L2 (~512 KiB), LLC (~32 MiB), and main memory (~256 MiB), with sequential and scattered probe access patterns. The bench supplies the evidence needed to decide whether a packed (rsum_low | bucket_idx) layout (#2072) would meaningfully improve cache behavior over the current 8-byte slot layout. Top-of-file comments document the perf stat and cachegrind invocations and the favorable / unfavorable thresholds that should inform the decision. Production code is unchanged. The bench-internal feature gains three read-only accessors on DeltaSignatureIndex (lookup_capacity, lookup_bytes, lookup_probe) so the bench can isolate the open- addressed probe chain from the surrounding match pipeline. * style(matching): apply rustfmt to compact_keys_cache bench * style(matching): inline MAX_ENTRIES_ENV in format string
oferchen
added a commit
that referenced
this pull request
May 18, 2026
…2073) (#4188) * bench(matching): compact-keys cache behavior across L1/L2/LLC sizes (#2073) Adds a Criterion bench that profiles DeltaSignatureIndex's compact lookup table at index sizes spanning L1 (~32 KiB), L2 (~512 KiB), LLC (~32 MiB), and main memory (~256 MiB), with sequential and scattered probe access patterns. The bench supplies the evidence needed to decide whether a packed (rsum_low | bucket_idx) layout (#2072) would meaningfully improve cache behavior over the current 8-byte slot layout. Top-of-file comments document the perf stat and cachegrind invocations and the favorable / unfavorable thresholds that should inform the decision. Production code is unchanged. The bench-internal feature gains three read-only accessors on DeltaSignatureIndex (lookup_capacity, lookup_bytes, lookup_probe) so the bench can isolate the open- addressed probe chain from the surrounding match pipeline. * style(matching): apply rustfmt to compact_keys_cache bench * style(matching): inline MAX_ENTRIES_ENV in format string
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…2073) (#4188) * bench(matching): compact-keys cache behavior across L1/L2/LLC sizes (#2073) Adds a Criterion bench that profiles DeltaSignatureIndex's compact lookup table at index sizes spanning L1 (~32 KiB), L2 (~512 KiB), LLC (~32 MiB), and main memory (~256 MiB), with sequential and scattered probe access patterns. The bench supplies the evidence needed to decide whether a packed (rsum_low | bucket_idx) layout (#2072) would meaningfully improve cache behavior over the current 8-byte slot layout. Top-of-file comments document the perf stat and cachegrind invocations and the favorable / unfavorable thresholds that should inform the decision. Production code is unchanged. The bench-internal feature gains three read-only accessors on DeltaSignatureIndex (lookup_capacity, lookup_bytes, lookup_probe) so the bench can isolate the open- addressed probe chain from the surrounding match pipeline. * style(matching): apply rustfmt to compact_keys_cache bench * style(matching): inline MAX_ENTRIES_ENV in format string
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.
Summary
crates/matching/benches/compact_keys_cache.rs, a Criterion bench that profilesDeltaSignatureIndex's compact lookup table at index sizes spanning L1 (~32 KiB), L2 (~512 KiB), LLC (~32 MiB), and main memory (~256 MiB), under both sequential and scattered probe access patterns.bench-internalfeature; the bench is excluded from default builds and never reaches release binaries.#[cfg(feature = "bench-internal")]accessors onDeltaSignatureIndex-lookup_capacity,lookup_bytes,lookup_probe- so the bench can isolate the open-addressed Robin Hood probe chain from the rest of the match pipeline.Why
The bench produces the cache-behavior evidence needed to decide whether the packed
(rsum_low | bucket_idx)layout proposed in #2072 is worth implementing. Top-of-file documentation captures:perf stat -e cache-misses,cache-references,LLC-loads,LLC-load-missesfor hardware counter data on Linux.valgrind --tool=cachegrindwith explicit--LL,--D1,--I1parameters for a deterministic, host-independent cache simulation. The bench prints the lookup-table footprint in bytes on stderr so the operator can pick--LLsizes that bracket the workload.Methodology
ram) tier needs ~512 MiB during index build and is opt-in viaMATCHING_BENCH_MAX_ENTRIES.sequentialwalks basis blocks in index order (prefetcher-friendly),scatteredwalks via an xorshift permutation that defeats prefetching.Production impact
None. The bench file is gated behind
bench-internal, the accessors are gated behind the same feature, and the existing index hot path is untouched.Test plan
bench-internal-gated additions get compile-checked via the bench harness).cargo bench -p matching --features bench-internal --bench compact_keys_cacheon a Linux host withperfto capture the cache-miss numbers for the Fix ignore-times handling for quick checks #2072 decision.valgrind --tool=cachegrindrun with the bench binary to produce host-independent miss counts.