Skip to content

Commit 72758c6

Browse files
committed
OPT: Optimize Python live decode path
1 parent 998b942 commit 72758c6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

databento/live/protocol.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def buffer_updated(self, nbytes: int) -> None:
255255
256256
"""
257257
logger.debug("read %d bytes from remote gateway", nbytes)
258-
data = self.__buffer[:nbytes]
258+
data = bytes(memoryview(self.__buffer)[:nbytes])
259259

260260
if self.authenticated.done():
261261
self._process_dbn(data)
@@ -375,7 +375,7 @@ def _process_dbn(self, data: bytes) -> None:
375375
raise ValueError("not connected")
376376

377377
try:
378-
self._dbn_decoder.write(bytes(data))
378+
self._dbn_decoder.write(data)
379379
records = self._dbn_decoder.decode()
380380
except Exception:
381381
logger.exception("error decoding DBN record")

0 commit comments

Comments
 (0)