jainankitk commented on issue #12527:
URL: https://github.com/apache/lucene/issues/12527#issuecomment-1714517103

   > Maybe next we should try 4 readLong() for readInts32? Though I wonder how 
often in this benchy are we really needing 32 bits to encode the docid deltas 
in a BKD leaf block?
   
   Why 4? we can just do single long for 2 ints. Although, I also doubt that we 
really need 32 bits to encode the docid deltas in a BKD leaf block in the 
benchmark.
   
   Following patch should work for achieving this:
   
   ```
   diff --git 
a/lucene/core/src/java/org/apache/lucene/util/bkd/DocIdsWriter.java 
b/lucene/core/src/java/org/apache/lucene/util/bkd/DocIdsWriter.java
   index 40db4c0069d..830e4ba43c9 100644
   --- a/lucene/core/src/java/org/apache/lucene/util/bkd/DocIdsWriter.java
   +++ b/lucene/core/src/java/org/apache/lucene/util/bkd/DocIdsWriter.java
   @@ -345,9 +345,14 @@ final class DocIdsWriter {
      }
    
      private void readInts32(IndexInput in, int count, IntersectVisitor 
visitor) throws IOException {
   -    in.readInts(scratch, 0, count);
   -    for (int i = 0; i < count; i++) {
   -      visitor.visit(scratch[i]);
   +    int i;
   +    for (i = 0; i < count - 1; i += 2) {
   +      long l = in.readLong();
   +      visitor.visit((int) (l >>> 32));
   +      visitor.visit((int) l);
   +    }
   +    for (; i < count; ++i) {
   +      visitor.visit(in.readInt());
        }
      }
    }
   ```


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