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

   Thanks @rmuir for feedback! This is the current implementation of 
`ArrayUtil#compareUnsigned4`:
   
   ```
   public static int compareUnsigned4(byte[] a, int aOffset, byte[] b, int 
bOffset) {
     return Integer.compareUnsigned(
         (int) BitUtil.VH_BE_INT.get(a, aOffset), (int) 
BitUtil.VH_BE_INT.get(b, bOffset));
   }
   ```
   
   I think it's equivalent to
   ```
   public static int compareUnsigned4(byte[] a, int aOffset, byte[] b, int 
bOffset) {
     return Integer.compare(NumericUtils.sortableBytesToInt(a, aOffset), 
NumericUtils.sortableBytesToInt(b, bOffset));
   }
   ```
   
   Because they are both doing a varhandle get and compare unsigned. The point 
of this PR is to avoid the decoding of one side as the query values are 
consistent during the intersect. 
   
   I'll do some JMH benchmark to confirm if there is any speed up.


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