jainankitk commented on code in PR #13599:
URL: https://github.com/apache/lucene/pull/13599#discussion_r1705858403


##########
lucene/core/src/java/org/apache/lucene/search/PointRangeQuery.java:
##########
@@ -127,22 +127,8 @@ public final Weight createWeight(IndexSearcher searcher, 
ScoreMode scoreMode, fl
 
       private final ByteArrayComparator comparator = 
ArrayUtil.getUnsignedComparator(bytesPerDim);
 
-      private boolean matches(byte[] packedValue) {
-        for (int dim = 0; dim < numDims; dim++) {
-          int offset = dim * bytesPerDim;
-          if (comparator.compare(packedValue, offset, lowerPoint, offset) < 0) 
{
-            // Doc's value is too low, in this dimension
-            return false;
-          }
-          if (comparator.compare(packedValue, offset, upperPoint, offset) > 0) 
{
-            // Doc's value is too high, in this dimension
-            return false;
-          }
-        }
-        return true;
-      }
-
-      private Relation relate(byte[] minPackedValue, byte[] maxPackedValue) {
+      private Relation relateHelper(
+          byte[] minPackedValue, byte[] maxPackedValue, boolean 
needCrossOrInside) {

Review Comment:
   I am not completely convinced about the readability part, since redundancy 
requires changing code at multiple places. Maybe there is more readable version 
of this code, that I am unable to think of. But I do see your point about 
non-obvious overheads. Initially, I assumed that method inlining should be able 
to mitigate this overhead, but the default size limit for inlining is fairly 
small 35 bytes.
   
   ```
   % java -XX:+PrintFlagsFinal -version | grep MaxInlineSize
        intx C1MaxInlineSize                          = 35                      
               {C1 product} {default}
        intx MaxInlineSize                            = 35                      
               {C2 product} {default}
   openjdk version "21.0.4" 2024-07-16 LTS
   ```



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