From 30a47cdee719e83706db46cdce839901c644901d Mon Sep 17 00:00:00 2001 From: Aditi Ahuja <48997495+metonymic-smokey@users.noreply.github.com> Date: Thu, 31 Oct 2024 01:22:06 +0530 Subject: [PATCH] MB-62230 - More pre-filtering optimisations (#275) Use AddMany() when populating cluster assignment map with vectors belonging to a cluster. --- faiss_vector_posting.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/faiss_vector_posting.go b/faiss_vector_posting.go index 83eb93c..eca5209 100644 --- a/faiss_vector_posting.go +++ b/faiss_vector_posting.go @@ -425,9 +425,11 @@ func (sb *SegmentBase) InterpretVectorIndex(field string, requiresFiltering bool if _, exists := centroidVecIDMap[centroidID]; !exists { centroidVecIDMap[centroidID] = roaring.NewBitmap() } + vecIDsUint32 := make([]uint32, 0, len(vecIDs)) for _, vecID := range vecIDs { - centroidVecIDMap[centroidID].Add(uint32(vecID)) + vecIDsUint32 = append(vecIDsUint32, uint32(vecID)) } + centroidVecIDMap[centroidID].AddMany(vecIDsUint32) } // Getting the vector IDs corresponding to the eligible