Skip to content

LUCENE-10366: Override #readVInt and #readVLong for ByteBufferDataInput to avoid the abstraction confusion of #readByte. #592

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

Merged
merged 20 commits into from
Jan 16, 2024
Merged
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
2 changes: 2 additions & 0 deletions lucene/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ Improvements
Optimizations
---------------------

* LUCENE-10366: Override readVInt() and readVLong() in ByteBufferDataInput to help Hotspot inline method. (Guo Feng)

* GITHUB#12839: Introduce method to grow arrays up to a given upper limit and use it to reduce overallocation for
DirectoryTaxonomyReader#getBulkOrdinals. (Stefan Vodita)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public final void readBytes(byte[] b, int offset, int len) throws IOException {
}

@Override
public void readLongs(long[] dst, int offset, int length) throws IOException {
public final void readLongs(long[] dst, int offset, int length) throws IOException {
// ByteBuffer#getLong could work but it has some per-long overhead and there
// is no ByteBuffer#getLongs to read multiple longs at once. So we use the
// below trick in order to be able to leverage LongBuffer#get(long[]) to
Expand Down Expand Up @@ -283,6 +283,18 @@ public final int readInt() throws IOException {
}
}

@Override
public final int readVInt() throws IOException {
// this can make JVM less confused (see LUCENE-10366)
return super.readVInt();
}

@Override
public final long readVLong() throws IOException {
// this can make JVM less confused (see LUCENE-10366)
return super.readVLong();
}

@Override
public final long readLong() throws IOException {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,18 @@ public final int readInt() throws IOException {
}
}

@Override
public final int readVInt() throws IOException {
// this can make JVM less confused (see LUCENE-10366)
return super.readVInt();
}

@Override
public final long readVLong() throws IOException {
// this can make JVM less confused (see LUCENE-10366)
return super.readVLong();
}

@Override
public final long readLong() throws IOException {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,18 @@ public final int readInt() throws IOException {
}
}

@Override
public final int readVInt() throws IOException {
// this can make JVM less confused (see LUCENE-10366)
return super.readVInt();
}

@Override
public final long readVLong() throws IOException {
// this can make JVM less confused (see LUCENE-10366)
return super.readVLong();
}

@Override
public final long readLong() throws IOException {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,18 @@ public final int readInt() throws IOException {
}
}

@Override
public final int readVInt() throws IOException {
// this can make JVM less confused (see LUCENE-10366)
return super.readVInt();
}

@Override
public final long readVLong() throws IOException {
// this can make JVM less confused (see LUCENE-10366)
return super.readVLong();
}

@Override
public final long readLong() throws IOException {
try {
Expand Down