diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 2b7222245f2..1757658dd92 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -78,6 +78,9 @@ Improvements * GITHUB#14154: Add UnwrappingReuseStrategy for AnalyzerWrapper that consults the wrapped analyzer's strategy to decide if components can be reused or need to be updated. (Mayya Sharipova) + +* GITHUB#14176: Reduce when visiting bpv24-encoded doc ids in BKD leaves. (Guo Feng) + Optimizations --------------------- diff --git a/lucene/core/src/java/org/apache/lucene/util/bkd/DocIdsWriter.java b/lucene/core/src/java/org/apache/lucene/util/bkd/DocIdsWriter.java index b9ea0d9aa08..805d7079b98 100644 --- a/lucene/core/src/java/org/apache/lucene/util/bkd/DocIdsWriter.java +++ b/lucene/core/src/java/org/apache/lucene/util/bkd/DocIdsWriter.java @@ -348,25 +348,11 @@ private void readDelta16(IndexInput in, int count, IntersectVisitor visitor) thr visitor.visit(scratchIntsRef); } - private static void readInts24(IndexInput in, int count, IntersectVisitor visitor) - throws IOException { - int i; - for (i = 0; i < count - 7; i += 8) { - long l1 = in.readLong(); - long l2 = in.readLong(); - long l3 = in.readLong(); - visitor.visit((int) (l1 >>> 40)); - visitor.visit((int) (l1 >>> 16) & 0xffffff); - visitor.visit((int) (((l1 & 0xffff) << 8) | (l2 >>> 56))); - visitor.visit((int) (l2 >>> 32) & 0xffffff); - visitor.visit((int) (l2 >>> 8) & 0xffffff); - visitor.visit((int) (((l2 & 0xff) << 16) | (l3 >>> 48))); - visitor.visit((int) (l3 >>> 24) & 0xffffff); - visitor.visit((int) l3 & 0xffffff); - } - for (; i < count; ++i) { - visitor.visit((Short.toUnsignedInt(in.readShort()) << 8) | Byte.toUnsignedInt(in.readByte())); - } + private void readInts24(IndexInput in, int count, IntersectVisitor visitor) throws IOException { + readInts24(in, count, scratch); + scratchIntsRef.ints = scratch; + scratchIntsRef.length = count; + visitor.visit(scratchIntsRef); } private void readInts32(IndexInput in, int count, IntersectVisitor visitor) throws IOException {