gf2121 commented on PR #14772:
URL: https://github.com/apache/lucene/pull/14772#issuecomment-2977389388

   Thanks for contribution, it's a nice speedup!
   
   > I don't believe that being able to use Arrays#fill helps much, but maybe 
the fact that this change helps reduce polymorphism does?
   
   I wonder if we can benchmark the following implementation to confirm the 
source of speedup?
   ```
   @Override
   public void nextDocsAndScores(int upTo, Bits liveDocs, 
DocAndFloatFeatureBuffer buffer)
       throws IOException {
     int batchSize = 64;
     buffer.growNoCopy(batchSize);
     int size = 0;
     DocIdSetIterator iterator = iterator();
     for (int doc = iterator.docID(); doc < upTo && size < batchSize; doc = 
iterator.nextDoc()) {
       if (liveDocs == null || liveDocs.get(doc)) {
         buffer.docs[size] = doc;
         buffer.scores[size] = score;
         ++size;
       }
     }
     buffer.size = size;
   }
   ```
   


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