yifan-c commented on code in PR #3815:
URL: https://github.com/apache/cassandra/pull/3815#discussion_r1925737172


##########
src/java/org/apache/cassandra/db/TypeSizes.java:
##########
@@ -47,19 +48,7 @@ public static int sizeof(String value)
 
     public static int encodedUTF8Length(String st)
     {
-        int strlen = st.length();
-        int utflen = 0;
-        for (int i = 0; i < strlen; i++)
-        {
-            int c = st.charAt(i);
-            if ((c >= 0x0001) && (c <= 0x007F))
-                utflen++;
-            else if (c > 0x07FF)
-                utflen += 3;
-            else
-                utflen += 2;
-        }
-        return utflen;
+        return ByteBufUtil.utf8Bytes(st);

Review Comment:
   Using the companion method from the same lib makes perfect sense. 
   Maybe perf was the reason of the custom implementation? 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to