Skip to content

Optimize HNSW plain-search filtered allocation#8175

Merged
timvisee merged 2 commits intodevfrom
optimize-hnsw-search-plain-filtered-allocation
Feb 19, 2026
Merged

Optimize HNSW plain-search filtered allocation#8175
timvisee merged 2 commits intodevfrom
optimize-hnsw-search-plain-filtered-allocation

Conversation

@agourlay
Copy link
Member

@agourlay agourlay commented Feb 19, 2026

This PR propagates the filtered point iterator properly avoiding unnecessary allocations.

Issue found through profiling where gigantic collect() calls shows up before scoring.

The HNSW plain search uses query_points to fetch the matching points from the payload index.
This allocates the full filtered result set in memory which is then used for scoring.

However the underlying search_plain_batched requires just an Iterator.

I was not able to refactor query_points to return an Iterator due to liftetime issues.
Therefore so I simply inlined this tiny body for this call site.

hw_counter,
is_stopped,
)
.collect()
Copy link
Member Author

Choose a reason for hiding this comment

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

the bad collect()

@agourlay agourlay marked this pull request as ready for review February 19, 2026 09:23
@timvisee timvisee merged commit 6ea4e74 into dev Feb 19, 2026
12 checks passed
@timvisee timvisee deleted the optimize-hnsw-search-plain-filtered-allocation branch February 19, 2026 09:58
timvisee pushed a commit that referenced this pull request Feb 19, 2026
* Optimize HNSW plain-search filtered allocation

* keep comment
@timvisee timvisee mentioned this pull request Feb 19, 2026
5 tasks
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.

3 participants