You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/09/14 22:35:36 UTC

[GitHub] [beam] robertwb commented on a diff in pull request #23192: Optimize varint reading and writing for small ints.

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


##########
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:
   Integers that fit into seven bits are stored as single bytes on 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: github-unsubscribe@beam.apache.org

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