You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2026/10/21 23:12:36 UTC

(lucene) branch branch_10_6 updated: Avoid redundant addresses.get() in sorted numeric rangeIntoBitSet (#16399)

This is an automated email from the ASF dual-hosted git repository.

HoustonPutman pushed a commit to branch branch_10_6
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/branch_10_6 by this push:
     new 968d090fbf9 Avoid redundant addresses.get() in sorted numeric rangeIntoBitSet (#16399)
968d090fbf9 is described below

commit 968d090fbf9e584d85de854e4e1ed3a4833bcf0d
Author: Sagar Upadhyaya <99...@users.noreply.github.com>
AuthorDate: Thu Aug 20 05:06:09 2026 -0700

    Avoid redundant addresses.get() in sorted numeric rangeIntoBitSet (#16399)
    
    (cherry picked from commit 5c79921132d8ea42b5ad155409fc14835c83325f)
---
 lucene/CHANGES.txt                                                     | 2 ++
 .../org/apache/lucene/codecs/lucene90/Lucene90DocValuesProducer.java   | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index f1b2bb4b99f..9834baec93f 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -195,6 +195,8 @@ Optimizations
 * GITHUB#16380: Speed up filtered disjunction queries when the filter is part of the
   index sort by advancing the filter before calculating impacts. (Alan Woodward)
 
+* GITHUB#16399: Reuse the previous end offset to skip a redundant addresses.get() in sorted numeric rangeIntoBitSet. (Sagar Upadhyaya)
+
 * GITHUB#16424: Use secondary or lower sorts to accelerate XXDocValuesRangeQueries if the primary
   sort field is empty or only contains a single value. (Alan Woodward)
 
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesProducer.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesProducer.java
index 3c25fa59fe1..c9e4bc13f1c 100644
--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesProducer.java
+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesProducer.java
@@ -2120,12 +2120,13 @@ final class Lucene90DocValuesProducer extends DocValuesProducer {
                 v, fromDoc, endDoc, cardinality, lo, hi, bitSet, offset);
             return;
           }
+          long startOffset = addresses.get(fromDoc);
           for (int currentDoc = fromDoc; currentDoc < endDoc; currentDoc++) {
-            long startOffset = addresses.get(currentDoc);
             long endOffset = addresses.get(currentDoc + 1L);
             if (sortedNumericMatchesRange(v, startOffset, endOffset, lo, hi)) {
               bitSet.set(currentDoc - offset);
             }
+            startOffset = endOffset;
           }
         }