mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
test_console_output: Avoid appending to bytes in a loop.
Appending to bytes in a loop leads to a quadratic slowdown since Python doesn’t optimize this for bytes like it does for str. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
f9271098bf
commit
b0b8f84949
@@ -35,7 +35,7 @@ class ExtraConsoleOutputFinder:
|
||||
]
|
||||
self.compiled_line_pattern = re.compile(b"|".join(valid_line_patterns))
|
||||
self.partial_line = b""
|
||||
self.full_extra_output = b""
|
||||
self.full_extra_output = bytearray()
|
||||
|
||||
def find_extra_output(self, data: bytes) -> None:
|
||||
*lines, self.partial_line = (self.partial_line + data).split(b"\n")
|
||||
|
||||
Reference in New Issue
Block a user