Speed up plain text frame helper (#692)

This commit is contained in:
J. Nick Koston 2023-11-24 11:46:15 -06:00 committed by GitHub
parent 0eb468ec61
commit 663f7ca950
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -21,9 +21,9 @@ cdef class APIPlaintextFrameHelper(APIFrameHelper):
add_length=bytes,
end_of_frame_pos=cython.uint,
length_int=cython.uint,
preamble=cython.uint,
length_high=cython.uint,
maybe_msg_type=cython.uint
preamble=char,
length_high=char,
maybe_msg_type=char
)
cpdef data_received(self, object data)

View File

@ -16,7 +16,7 @@ def _varuint_to_bytes(value: _int) -> bytes:
if value <= 0x7F:
return bytes((value,))
result = []
result = bytearray()
while value:
temp = value & 0x7F
value >>= 7