franz1981 commented on code in PR #12163:
URL: https://github.com/apache/kafka/pull/12163#discussion_r873638337


##########
clients/src/main/java/org/apache/kafka/common/utils/Checksums.java:
##########
@@ -40,11 +55,41 @@ public static void update(Checksum checksum, ByteBuffer 
buffer, int length) {
     public static void update(Checksum checksum, ByteBuffer buffer, int 
offset, int length) {
         if (buffer.hasArray()) {
             checksum.update(buffer.array(), buffer.position() + 
buffer.arrayOffset() + offset, length);
-        } else {
-            int start = buffer.position() + offset;
-            for (int i = start; i < start + length; i++)
-                checksum.update(buffer.get(i));
+            return;
+        }
+        if (BYTE_BUFFER_UPDATE != null && buffer.isDirect()) {
+            final int oldPosition = buffer.position();

Review Comment:
   We are moving `limit` as well, hence I don't see any advantage re using 
`mark/reset`.
   Let me know If I've missed something



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to