Skip to content
This repository was archived by the owner on Feb 2, 2026. It is now read-only.

Commit 8cc1384

Browse files
committed
Improve read performance
1 parent 0b16b03 commit 8cc1384

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

vxi11/vxi11.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ def read_raw(self, num=-1):
608608
flags = OP_FLAG_TERMCHAR_SET
609609
term_char = str(self.term_char).encode('utf-8')[0]
610610

611-
read_data = b''
611+
read_data = bytearray()
612612

613613
while reason & (RX_END | RX_CHR) == 0:
614614
error, reason, data = self.client.device_read(self.link,
@@ -621,7 +621,7 @@ def read_raw(self, num=-1):
621621
if error:
622622
raise Vxi11Exception(error, 'read')
623623

624-
read_data += data
624+
read_data.extend(data)
625625

626626
if num > 0:
627627
num = num - len(data)
@@ -630,7 +630,7 @@ def read_raw(self, num=-1):
630630
if num < read_len:
631631
read_len = num
632632

633-
return read_data
633+
return bytes(read_data)
634634

635635
def ask_raw(self, data, num=-1):
636636
"Write then read binary data"

0 commit comments

Comments
 (0)