benwtrent commented on issue #14763:
URL: https://github.com/apache/lucene/issues/14763#issuecomment-2956287088

   ```
   8.63%         382600        java.util.Arrays#fill() [Inlined code]
                                 at org.apache.lucene.util.FixedBitSet#clear() 
[Inlined code]
                                 at 
org.apache.lucene.util.hnsw.HnswGraphSearcher#prepareScratchState() [Inlined 
code]
                                 at 
org.apache.lucene.util.hnsw.HnswGraphSearcher#searchLevel() [JIT compiled code]
   ```
   
   The main caller for `prepareScratchState` is during graph building. However, 
we will clear the bit set between finding the best entry point and searching 
the bottom layer. So, it *SHOULD* only be called twice per segment, no matter 
then graph size.
   
   The question that leaves two questions:
   
    - "Do we need to clear the bitset between finding the entry point and 
search layer 0 at search time" and honestly, since we only do it twice, I think 
keeping it in is fine. My concern would be if we actually have to span our 
further due to result filtering, we might actually miss nearest neighbors that 
were explored on previous levels.
   
   
    - "Do we need to clear the bitset during index building". This one is 
trickier. I think there is some optimization we can do here as by definition, 
the entrypoint we find at a layer is the nearest vector and all previously 
explored vectors at previous layers are further away.


-- 
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