You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/07/27 10:18:06 UTC

[GitHub] [lucene] luyuncheng commented on a diff in pull request #1047: LUCENE-10661: Reduce memory copy in BytesStore

luyuncheng commented on code in PR #1047:
URL: https://github.com/apache/lucene/pull/1047#discussion_r930884228


##########
lucene/core/src/java/org/apache/lucene/util/fst/BytesStore.java:
##########
@@ -179,6 +179,30 @@ void writeBytes(long dest, byte[] b, int offset, int len) {
     }
   }
 
+  @Override
+  public void copyBytes(DataInput input, long numBytes) throws IOException {
+    assert numBytes >= 0 : "numBytes=" + numBytes;
+    assert input != null;
+    int len = (int) numBytes;

Review Comment:
   As DataInput#readBytes received a int `len` parameters, and numBytes is a `long` type, anyway, we need a cast. 
   
   In the commits [4b9f4b](https://github.com/apache/lucene/pull/1047/commits/4b9f4b35479246aa17fdd6e2628d4f3460cb98a4), i try to rewrite copyBytes method, i moved check with `Math.min(chunk, len)`



-- 
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