-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Removing unnecessary ByteArrayDataInput allocations by resetting inplace #14113
Conversation
Signed-off-by: Ankit Jain <[email protected]>
@@ -1324,8 +1324,12 @@ private void decompressBlock() throws IOException { | |||
} | |||
|
|||
// Reset the buffer. | |||
blockInput = | |||
new ByteArrayDataInput(blockBuffer.bytes, blockBuffer.offset, blockBuffer.length); | |||
if (blockInput == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should create the blockInput on the constructor and make it final.
Signed-off-by: Ankit Jain <[email protected]>
@@ -1149,6 +1148,8 @@ private class TermsDict extends BaseTermsEnum { | |||
// add 7 padding bytes can help decompression run faster. | |||
int bufferSize = entry.maxBlockLength + entry.maxTermLength + LZ4_DECOMPRESSOR_PADDING; | |||
blockBuffer = new BytesRef(new byte[bufferSize], 0, bufferSize); | |||
blockInput = | |||
new ByteArrayDataInput(blockBuffer.bytes, blockBuffer.offset, blockBuffer.length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: you can initialize it without arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
Signed-off-by: Ankit Jain <[email protected]>
Could you add an entry in CHANGES.txt under the lucene 10.2 section? |
Signed-off-by: Ankit Jain <[email protected]>
…ace (#14113) Removing unnecessary ByteArrayDataInput allocations by resetting inplace Signed-off-by: Ankit Jain <[email protected]>
Thank you @jainankitk! |
Description
Resolves #14112