opensearch-project / k-NN

🆕 Find the k-nearest neighbors (k-NN) for your vector data
https://opensearch.org/docs/latest/search-plugins/knn/index/
Apache License 2.0
152 stars 113 forks source link

[Enhancement] Optimize searchTopK Method in ExactSearcher for Improved Performance #2145

Closed junqiu-lei closed 2 hours ago

junqiu-lei commented 3 days ago

What is the enhancement? We can optimize the reduceToTopK method by removing unnecessary pre-filling, reducing redundant peek() calls for better performance.

Code ref: https://github.com/opensearch-project/k-NN/blob/main/src/main/java/org/opensearch/knn/index/query/ResultUtil.java#L33-L59