mrkm4ntr opened a new pull request, #14771:
URL: https://github.com/apache/lucene/pull/14771

   ### Description
   If a filter query in kNN is in query cache, it can be saved as a 
`BitSetIterator` wrapping a `FixedBitSet`. But we are creating new 
`FixedBitSet` combined with liveDocs for every query. This is really high cost 
because it needs to iterate over long BitSet in `applyMask`.
   Instead of creating new BitSet by iteration, I will create new BitSet 
implementing only reading methods. By using this, we don't need to iterate over 
BitSet. We can leverage `intersectionCount` of FixedBitSet that is super fast.
   
   
   This is the flamegraph when I ran filtered kNN queries (k=100, 
num_candidates=100, term filter that filters out about 50% of documents).
   ![スクリーンショット 2025-06-12 16 21 
14](https://github.com/user-attachments/assets/0b50af07-b6ff-44f4-b3ed-5b585c925e84)
   
   
   After applying this, `applyMask` disappeared completely.
   ![スクリーンショット 2025-06-12 16 24 
43](https://github.com/user-attachments/assets/6a283364-2e33-4201-8bae-a5ab9c76b49f)
   
   <!--
   If this is your first contribution to Lucene, please make sure you have 
reviewed the contribution guide.
   https://github.com/apache/lucene/blob/main/CONTRIBUTING.md
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to