You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/12/10 16:14:10 UTC

[GitHub] [lucene] gf2121 commented on pull request #12006: Do int compare instead of ArrayUtil#compareUnsigned4 in LatlonPointQueries

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-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org