jpountz opened a new issue, #12826:
URL: https://github.com/apache/lucene/issues/12826

   ### Description
   
   We switched tail postings from regular vints to group-varint in #12782, 
implemented on top of the `DataInput`/`DataOutput` abstraction. Should we move 
this special encoding directly to `DataInput`/`DataOutput`? This could help 
optimize the logic further on some `Directory` implementations? For instance, 
on `MmapDirectory`/Java 21, it could look something like below, which is more 
aligned with how group-varint is generally implemented?
   
   ```java
     private static final int[] MASKS = new int[] { 0xFF, 0xFFFF, 0xFFFFFF, 
0xFFFFFFFF };
   
     @Override
     public void readVIntGroup(DataInput in, long[] docs, int i) throws 
IOException {
       if (curSegment.byteSize() - curPosition < 17) {
         super.readVIntGroup(in, docs, i);
         return;
       }
       
       final int flag = in.readByte() & 0xFF;
   
       final int n1Minus1 = flag >> 6;
       final int n2Minus1 = (flag >> 4) & 0x03;
       final int n3Minus1 = (flag >> 2) & 0x03;
       final int n4Minus1 = flag & 0x03;
   
       docs[i] = curSegment.get(LAYOUT_LE_INT, curPosition) & MASKS[n1Minus1];
       curPosition += 1 + n1Minus1;
       docs[i + 1] = curSegment.get(LAYOUT_LE_INT, curPosition) & 
MASKS[n2Minus1];
       curPosition += 1 + n2Minus1;
       docs[i + 2] = curSegment.get(LAYOUT_LE_INT, curPosition) & 
MASKS[n3Minus1];
       curPosition += 1 + n3Minus1;
       docs[i + 3] = curSegment.get(LAYOUT_LE_INT, curPosition) & 
MASKS[n4Minus1];
       curPosition += 1 + n4Minus1;
     }
   ```


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