Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce virtual calls when visiting bpv24-encoded doc ids in BKD leaves #14176

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lucene/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
---------------------
Expand Down
24 changes: 5 additions & 19 deletions lucene/core/src/java/org/apache/lucene/util/bkd/DocIdsWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down