You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "divijvaidya (via GitHub)" <gi...@apache.org> on 2023/02/28 16:08:51 UTC

[GitHub] [kafka] divijvaidya commented on a diff in pull request #13312: KAFKA-14766: Improve performance of VarInt encoding and decoding

divijvaidya commented on code in PR #13312:
URL: https://github.com/apache/kafka/pull/13312#discussion_r1120323557


##########
clients/src/main/java/org/apache/kafka/common/utils/ByteUtils.java:
##########
@@ -150,17 +151,32 @@ public static void writeUnsignedIntLE(byte[] buffer, int offset, int value) {
      * @throws IllegalArgumentException if variable-length value does not terminate after 5 bytes have been read
      */
     public static int readUnsignedVarint(ByteBuffer buffer) {

Review Comment:
   Sure, will do. 
   
   Also protobuf has a similar unrolled implementation for its c++ code at https://github.com/protocolbuffers/protobuf/blob/2dc5338ea222e1f4e0357e46b702ed6a0e82aaeb/src/google/protobuf/io/coded_stream.cc#L422 (it's Java variant doesn't use the unrolled implementation since they decided to add a different implementation which favours cases when varints are 1 byte).



-- 
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-unsubscribe@kafka.apache.org

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