dajac commented on a change in pull request #9619:
URL: https://github.com/apache/kafka/pull/9619#discussion_r526710893



##########
File path: 
clients/src/main/java/org/apache/kafka/common/protocol/SendBuilder.java
##########
@@ -122,6 +123,14 @@ public void writeVarlong(long i) {
         ByteUtils.writeVarlong(i, buffer);
     }
 
+    private void flushPendingSend() {
+        if (!buffers.isEmpty()) {
+            ByteBuffer[] byteBufferArray = buffers.toArray(new ByteBuffer[0]);
+            sends.add(new ByteBufferSend(destinationId, byteBufferArray));

Review comment:
       I just noticed that `ByteBufferSend` re-iterates over the byte buffers 
to compute the total size. We could compute the size while we accumulate them. 
I suppose that the number of buffers is usually small so it should not make a 
big difference.




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

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


Reply via email to