Skip to content

[diskann-inmem] Remove allocation during prune - #1523

Open
Mark Hildebrand (hildebrandmw) wants to merge 3 commits into
mainfrom
mhildebr/inmem-perf
Open

Mark Hildebrand (hildebrandmw) wants to merge 3 commits into
mainfrom
mhildebr/inmem-perf

Conversation

@hildebrandmw

Copy link
Copy Markdown
Contributor

The PruneKey design for repr::Prune was based off of theoretically needing to support hybrid prune for PQ. Since it seems like we won't need to support that (or may still be able to by other means), we can simplify back to using slices and avoid allocating the hash table.

Increases in get_vector counts are due to robust_prune_list, which now goes through all the way to the Store instead of into the hash table. The total number of vector accesses does not necessarily increase: just the number that behave as if going through the store.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Documentation links to removed methods remain unresolved and fail the docs job under -D rustdoc::all.

1 open issue
What changed in this PR

Simplifies in-memory graph pruning by replacing buffered prune keys with borrowed slices, removing the hash-table and pointer-buffer allocations.

Changes:

  • Updates prune accessors and tests to retrieve and compare slices directly.
  • Moves vector-access counting to retrieval and refreshes integration baselines.
  • Centralizes the erased-serde dependency in the workspace.
File Description
diskann-inmem/​src/​store/​intrusive.rs Removes the unused byte-length helper.
diskann-inmem/​src/​repr/​test/​mod.rs Tests slice retrieval and distance evaluation.
diskann-inmem/​src/​repr/​mod.rs Replaces prune keys with a slice-based interface.
diskann-inmem/​src/​repr/​internal/​intrusive.rs Removes pointer buffering during pruning.
diskann-inmem/​src/​repr/​full.rs Adapts full-precision prune tests.
diskann-inmem/​src/​provider.rs Removes the key map and uses borrowed element references.
diskann-inmem/​src/​counters.rs Adds shared-reference vector-access counting.
diskann-inmem/​integration/​jsons/​integration-baseline.json Refreshes vector-access counts.
diskann-inmem/​integration/​jsons/​graph/​spherical/​two-bit-l2-baseline.json Refreshes vector-access counts.
diskann-inmem/​integration/​jsons/​graph/​spherical/​two-bit-ip-baseline.json Refreshes vector-access counts.
diskann-inmem/​integration/​jsons/​graph/​spherical/​two-bit-cosine-baseline.json Refreshes vector-access counts.
diskann-inmem/​integration/​jsons/​graph/​spherical/​one-bit-l2-baseline.json Refreshes vector-access counts.
diskann-inmem/​integration/​jsons/​graph/​spherical/​one-bit-ip-baseline.json Refreshes vector-access counts.
diskann-inmem/​integration/​jsons/​graph/​spherical/​one-bit-cosine-baseline.json Refreshes vector-access counts.
diskann-inmem/​integration/​jsons/​graph/​spherical/​four-bit-l2-baseline.json Refreshes vector-access counts.
diskann-inmem/​integration/​jsons/​graph/​spherical/​four-bit-ip-baseline.json Refreshes vector-access counts.
diskann-inmem/​integration/​jsons/​graph/​spherical/​four-bit-cosine-baseline.json Refreshes vector-access counts.
diskann-inmem/​integration/​jsons/​graph/​scalar/​two-bit-cosine-baseline.json Refreshes vector-access counts.
diskann-inmem/​integration/​jsons/​graph/​scalar/​one-bit-l2-baseline.json Refreshes vector-access counts.
diskann-inmem/​integration/​jsons/​graph/​scalar/​four-bit-ip-baseline.json Refreshes vector-access counts.
diskann-inmem/​integration/​jsons/​graph/​scalar/​eight-bit-l2-baseline.json Refreshes vector-access counts.
diskann-inmem/​integration/​jsons/​graph/​product/​l2-baseline.json Refreshes vector-access counts.
diskann-inmem/​integration/​jsons/​graph/​product/​ip-baseline.json Refreshes vector-access counts.
diskann-inmem/​integration/​jsons/​graph/​product/​cosine-baseline.json Refreshes vector-access counts.
diskann-benchmark-runner/​Cargo.toml Inherits erased-serde from the workspace.
Cargo.toml Declares the shared erased-serde dependency.

Review effort: Balanced

Comment thread diskann-inmem/src/repr/mod.rs Outdated
Comment on lines 256 to 257
/// Implementations may assume that `a` and `b` were produced by a call to
/// [`Self::prepare`] and are allowed to panic if this is violated. This property may
Base automatically changed from mhildebr/inmem-regression to main October 30, 2026 17:37
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.95918% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.02%. Comparing base (a301647) to head (4b103d4).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
diskann-inmem/src/store/intrusive.rs 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1523      +/-   ##
==========================================
- Coverage   92.06%   91.02%   -1.04%     
==========================================
  Files         605      605              
  Lines      125494   125463      -31     
==========================================
- Hits       115532   114202    -1330     
- Misses       9962    11261    +1299     
Flag Coverage Δ
miri 91.02% <97.95%> (-1.04%) ⬇️
unittests 90.73% <97.95%> (-1.28%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
diskann-inmem/src/counters.rs 100.00% <100.00%> (ø)
diskann-inmem/src/provider.rs 96.16% <100.00%> (-0.46%) ⬇️
diskann-inmem/src/repr/full.rs 97.11% <100.00%> (-0.01%) ⬇️
diskann-inmem/src/repr/internal/intrusive.rs 100.00% <100.00%> (ø)
diskann-inmem/src/repr/mod.rs 95.23% <ø> (+1.48%) ⬆️
diskann-inmem/src/repr/test/mod.rs 94.85% <100.00%> (+0.07%) ⬆️
diskann-inmem/src/store/intrusive.rs 92.88% <0.00%> (-1.07%) ⬇️

... and 51 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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.

4 participants