You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "jainankitk (via GitHub)" <gi...@apache.org> on 2025/01/08 06:54:11 UTC

[PR] Removing unnecessary ByteArrayDataInput allocations by resetting inplace [lucene]

jainankitk opened a new pull request, #14113:
URL: https://github.com/apache/lucene/pull/14113

   ### Description
   
   Resolves #14112 
   
   <!--
   If this is your first contribution to Lucene, please make sure you have reviewed the contribution guide.
   https://github.com/apache/lucene/blob/main/CONTRIBUTING.md
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Removing unnecessary ByteArrayDataInput allocations by resetting inplace [lucene]

Posted by "iverase (via GitHub)" <gi...@apache.org>.
iverase commented on code in PR #14113:
URL: https://github.com/apache/lucene/pull/14113#discussion_r1907744833


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesProducer.java:
##########
@@ -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);

Review Comment:
   nit: you can initialize it without arguments. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Removing unnecessary ByteArrayDataInput allocations by resetting inplace [lucene]

Posted by "iverase (via GitHub)" <gi...@apache.org>.
iverase commented on PR #14113:
URL: https://github.com/apache/lucene/pull/14113#issuecomment-2579540926

   Could you add an entry in CHANGES.txt under the lucene 10.2 section?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Removing unnecessary ByteArrayDataInput allocations by resetting inplace [lucene]

Posted by "iverase (via GitHub)" <gi...@apache.org>.
iverase merged PR #14113:
URL: https://github.com/apache/lucene/pull/14113


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Removing unnecessary ByteArrayDataInput allocations by resetting inplace [lucene]

Posted by "iverase (via GitHub)" <gi...@apache.org>.
iverase commented on PR #14113:
URL: https://github.com/apache/lucene/pull/14113#issuecomment-2581907157

   Thank you @jainankitk!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Re: [PR] Removing unnecessary ByteArrayDataInput allocations by resetting inplace [lucene]

Posted by "iverase (via GitHub)" <gi...@apache.org>.
iverase commented on code in PR #14113:
URL: https://github.com/apache/lucene/pull/14113#discussion_r1906591388


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesProducer.java:
##########
@@ -1324,8 +1324,12 @@ private void decompressBlock() throws IOException {
         }
 
         // Reset the buffer.
-        blockInput =
-            new ByteArrayDataInput(blockBuffer.bytes, blockBuffer.offset, blockBuffer.length);
+        if (blockInput == null) {

Review Comment:
   I wonder if we should create the blockInput on the constructor and make it final.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org