1996fanrui commented on code in PR #24717:
URL: https://github.com/apache/flink/pull/24717#discussion_r1579063045


##########
flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/NoFetchingInput.java:
##########
@@ -114,18 +121,26 @@ public void readBytes(byte[] bytes, int offset, int 
count) throws KryoException
             throw new IllegalArgumentException("bytes cannot be null.");
         }
 
+        if (count == 0) {
+            return;
+        }
+
         try {
             int bytesRead = 0;
             int c;
 
-            while (bytesRead < count) {
+            while (true) {
                 c = inputStream.read(bytes, offset + bytesRead, count - 
bytesRead);
 
                 if (c == -1) {
                     throw new KryoException(new EOFException("No more bytes 
left."));
                 }
 
                 bytesRead += c;
+
+                if (bytesRead == count) {

Review Comment:
   > Not to block this, just curious do you know why 
[FLINK-34954](https://issues.apache.org/jira/browse/FLINK-34954) affects 
performance?
   
   Hi @reswqa ,  I'm not very sure the reason. But I guess:
   
   - For non-empty data, let us assume `inputStream.read` will be called once.
     - Before FLINK-34954, we only check `bytesRead == count` once.
     - After FLINK-34954, we call `bytesRead < count` twice.
   - Also, I'm not sure whether FLINK-34954 breaks any JIT optimization.



-- 
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-unsubscr...@flink.apache.org

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

Reply via email to