Skip to content

perf: avoid allocating filtered nodes on HNSW search path#5377

Merged
BubbleCal merged 2 commits intolance-format:mainfrom
BubbleCal:hnsw-perf-review
Dec 2, 2025
Merged

perf: avoid allocating filtered nodes on HNSW search path#5377
BubbleCal merged 2 commits intolance-format:mainfrom
BubbleCal:hnsw-perf-review

Conversation

@BubbleCal
Copy link
Copy Markdown
Contributor

@BubbleCal BubbleCal commented Dec 1, 2025

  • streamline beam_search neighbor processing to drop an extra allocation and add a zero-alloc bitset iterator
  • make flat-search prefilter iteration allocation-free with buffered prefetch and retune hnsw bench to 100k x128 K=100
  • Bench: search_hnsw100000x128 321.76µs -> 265.44µs (~20% faster)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 1, 2025

ACTION NEEDED
Lance follows the Conventional Commits specification for release automation.

The PR title and description are used as the merge commit message. Please update your PR title and description to match the specification.

For details on the error please inspect the "PR Title Check" action.

@BubbleCal BubbleCal changed the title Optimize HNSW search hot path and update bench scale perf: avoid allocating filtered nodes on HNSW search path Dec 1, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 1, 2025

Codecov Report

❌ Patch coverage is 11.11111% with 40 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rust/lance-index/src/vector/hnsw/builder.rs 0.00% 37 Missing ⚠️
rust/lance-index/src/vector/graph.rs 62.50% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Collaborator

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

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

Nice change!

@BubbleCal BubbleCal merged commit 6e45898 into lance-format:main Dec 2, 2025
38 of 43 checks passed
jackye1995 pushed a commit to jackye1995/lance that referenced this pull request Jan 21, 2026
…at#5377)

- streamline beam_search neighbor processing to drop an extra allocation
and add a zero-alloc bitset iterator
- make flat-search prefilter iteration allocation-free with buffered
prefetch and retune hnsw bench to 100k x128 K=100
- Bench: search_hnsw100000x128 321.76µs -> 265.44µs (~20% faster)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants