sjvanrossum commented on code in PR #29633:
URL: https://github.com/apache/beam/pull/29633#discussion_r1418190556


##########
sdks/java/core/src/main/java/org/apache/beam/sdk/util/VarInt.java:
##########
@@ -42,13 +42,33 @@ public static void encode(int v, OutputStream stream) 
throws IOException {
 
   /** Encodes the given value onto the stream. */
   public static void encode(long v, OutputStream stream) throws IOException {
+    // Write 1-5 bytes
+    if ((v & ~0xFFFFFFFFL) == 0) {

Review Comment:
   This is mostly a remnant from when I was thinking this should be split 
between ints and longs.
   Currently it will split on the middle of the 5th segment of 7 bits, anything 
using the top 3 bits (longs) of that byte will write to the byte array, 
anything using the lower 4 bits (ints) will write directly to the stream.
   
   This could be any mask and might be worth changing based on the x86-64 
results such that anything which produces only 2 bytes writes directly to the 
stream and more bytes to the byte array.



-- 
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]

Reply via email to