sjvanrossum commented on code in PR #36959:
URL: https://github.com/apache/beam/pull/36959#discussion_r2581995612
##########
sdks/java/core/src/main/java/org/apache/beam/sdk/util/VarInt.java:
##########
@@ -136,16 +136,19 @@ public static long decodeLong(InputStream stream) throws
IOException {
/** Returns the length of the encoding of the given value (in bytes). */
public static int getLength(int v) {
- return getLength(convertIntToLongNoSignExtend(v));
+ // log2(v) / 7 + 1 rewritten as multiplication by 9/64 instead of a
division by 7.
Review Comment:
`CodedInputStream` may access the stream's buffer without reading into an
intermediate buffer. In the case of Beam we could call `InputStream#mark()`,
attempt to read into a temporary `byte[5]` or `byte[10]` and use that when
unrolling the decode routine. I can look into that in a separate 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]