divijvaidya commented on code in PR #13312: URL: https://github.com/apache/kafka/pull/13312#discussion_r1120354148
########## clients/src/main/java/org/apache/kafka/common/utils/ByteUtils.java: ########## @@ -292,29 +415,66 @@ public static double readDouble(ByteBuffer buffer) { * @param buffer The output to write to */ public static void writeUnsignedVarint(int value, ByteBuffer buffer) { Review Comment: Netty uses the default loop based implementation: https://github.com/netty/netty/blob/5d1f99655918c9c034ca090d51b64eced73f742f/codec/src/main/java/io/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrepender.java#L58 I wasn't able to find a project which does what we are doing [except for the blog post](https://steinborn.me/posts/performance/how-fast-can-you-write-a-varint/) I mentioned above and over [here](https://github.com/richardstartin/varints/blob/main/src/main/java/io/github/richardstartin/varints/SmartNoDataDependencyVarIntState.java). Note that protobuf uses unrolled implementation for it's c++ code at https://github.com/protocolbuffers/protobuf/blob/2dc5338ea222e1f4e0357e46b702ed6a0e82aaeb/src/google/protobuf/io/coded_stream.h#L913 Not that it matters for us since compilers are different from Java & c++ but adding it here as a data point. -- 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