Skip to content

Commit

Permalink
feat: speed up unmarshaller (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Oct 26, 2022
1 parent 6094b85 commit 8f7f982
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/dbus_fast/_private/unmarshaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,7 @@ def header_fields(self, header_length: int) -> Dict[str, Any]:
signature_len = buf[self._pos] # byte
o = self._pos + 1
self._pos += signature_len + 2 # one for the byte, one for the '\0'
type_ = get_signature_tree(buf[o : o + signature_len].decode()).types[0]
token = type_.token
token = buf[o : o + signature_len].decode()
# Now that we have the token we can read the variant value
key = HEADER_MESSAGE_ARG_NAME[field_0]
# Strings and signatures are the most common types
Expand All @@ -378,7 +377,7 @@ def header_fields(self, header_length: int) -> Dict[str, Any]:
else:
# There shouldn't be any other types in the header
# but just in case, we'll read it using the slow path
headers[key] = readers[type_.token](self, type_)
headers[key] = readers[token](self, get_signature_tree(token).types[0])
return headers

def _read_header(self) -> None:
Expand Down

0 comments on commit 8f7f982

Please sign in to comment.