You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by so...@apache.org on 2026/08/20 12:06:15 UTC

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

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

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


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

commit 5c79921132d8ea42b5ad155409fc14835c83325f
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)
---
 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 3a3fdbf3ec7..8f59c576b25 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -436,6 +436,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 fa6d59a149a..cdefbca58ff 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
@@ -2059,12 +2059,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;
           }
         }