AnandInguva commented on code in PR #23192:
URL: https://github.com/apache/beam/pull/23192#discussion_r970161197


##########
sdks/python/apache_beam/coders/stream.pyx:
##########
@@ -183,15 +192,16 @@ cdef class InputStream(object):
 
   cpdef libc.stdint.int64_t read_var_int64(self) except? -1:
     """Decode a variable-length encoded long from a stream."""
-    cdef long byte
+    # Inline common case.
+    cdef long byte = <unsigned char> self.allc[self.pos]
+    self.pos += 1
+    if byte < 0x7F:

Review Comment:
   Can you explain this condition?



##########
sdks/python/apache_beam/coders/stream.pyx:
##########
@@ -59,6 +59,12 @@ cdef class OutputStream(object):
   cpdef write_var_int64(self, libc.stdint.int64_t signed_v):
     """Encode a long using variable-length encoding to a stream."""
     cdef libc.stdint.uint64_t v = signed_v
+    # Inline common case.
+    if v <= 0x7F and self.pos < self.buffer_size - 1:

Review Comment:
   v < 0x7F ? Following this from line 198



##########
sdks/python/apache_beam/coders/stream.pyx:
##########
@@ -183,15 +192,16 @@ cdef class InputStream(object):
 
   cpdef libc.stdint.int64_t read_var_int64(self) except? -1:
     """Decode a variable-length encoded long from a stream."""
-    cdef long byte
+    # Inline common case.
+    cdef long byte = <unsigned char> self.allc[self.pos]
+    self.pos += 1
+    if byte < 0x7F:

Review Comment:
   Does this represent we need to read the next byte in the stream?



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