浏览代码

patman: Use bytearray instead of string

If the process outputs a lot of data on stdout this can be quite slow,
since the bytestring is regenerated each time. Use a bytearray instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass 2 年之前
父节点
当前提交
c31d0cb68c
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      tools/patman/cros_subprocess.py

+ 3 - 3
tools/patman/cros_subprocess.py

@@ -169,11 +169,11 @@ class Popen(subprocess.Popen):
                 self.stdin.close()
         if self.stdout:
             read_set.append(self.stdout)
-            stdout = b''
+            stdout = bytearray()
         if self.stderr and self.stderr != self.stdout:
             read_set.append(self.stderr)
-            stderr = b''
-        combined = b''
+            stderr = bytearray()
+        combined = bytearray()
 
         input_offset = 0
         while read_set or write_set: