jpountz commented on PR #14203:
URL: https://github.com/apache/lucene/pull/14203#issuecomment-2726015514

   Thanks for running benchmarks. So it looks like the JVM doesn't think these 
shorter loops (with step 128) are worth unrolling? This makes me wonder how 
something like that  performs on your AVX-512 CPU. I think you had something 
similar in one of your previous iterations. On my machine it's on par with the 
current version.
   
   ```java
     private void readInts24(IndexInput in, int count, int[] docIDs) throws 
IOException {
       if (count == BKDConfig.DEFAULT_MAX_POINTS_IN_LEAF_NODE) {
         // Same format, but enabling the JVM to specialize the decoding logic 
for the default number
         // of points per node proved to help on benchmarks
         doReadInts24(in, 512, docIDs);
       } else {
         doReadInts24(in, count, docIDs);
       }
     }
   
     private void doReadInts24(IndexInput in, int count, int[] docIDs) throws 
IOException {
       // Read the first (count - count % 4) values
       int quarter = count >> 2;
       int numBytes = quarter * 3;
       in.readInts(scratch, 0, numBytes);
       for (int i = 0; i < numBytes; ++i) {
         docIDs[i] = scratch[i] >>> 8;
         scratch[i] &= 0xFF;
       }
       for (int i = 0; i < quarter; ++i) {
         docIDs[numBytes + i] = scratch[i]
            | (scratch[quarter + i] << 8)
            | (scratch[2 * quarter + i] << 16);
       }
       // Now read the remaining 0, 1, 2 or 3 values
       for (int i = quarter << 2; i < count; ++i) {
         docIDs[i] = (in.readShort() & 0xFFFF) | (in.readByte() & 0xFF) << 16;
       }
     }
   ```


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