divijvaidya commented on code in PR #12685: URL: https://github.com/apache/kafka/pull/12685#discussion_r1250947571
########## clients/src/main/java/org/apache/kafka/common/utils/Utils.java: ########## @@ -517,6 +519,50 @@ public static int murmur2(final byte[] data) { return h; } + /** + * Generates 32 bit murmur2 hash from ByteBuffer + * @param data ByteBuffer to hash + * @return 32 bit hash of the given ByteBuffer + */ + @SuppressWarnings("fallthrough") + public static int murmur2(ByteBuffer data) { Review Comment: That's fair. Prior to this change byte[] would also have been stored contiguously hence reading 4 bytes would have been faster whereas HeapByteBuffer may perform random seeks to read the entire int. It's fine since I don't see how we can potentially avoid this but note that this may offset gains that we are getting by removing the data copy in this PR. -- 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