From b97de63d2feaeb7710b7550dfc4144f41f5c8fc6 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 19 Nov 2024 21:40:06 +0000 Subject: [PATCH] bitbake: bitbake-worker: Improve bytearray truncation performance If there are large amounts of data being transferred to the cooker from the worker, recreating the bytearray becomes inefficient as it happens for every pipesize block of data, defaulting to 64kb. Instead we can use the deletion API for bytearrays to make this more efficient and avoid the object recreation. We noticed this with a strace ptest image taking days to complete the build after having 6GB of data in the testimage log. Whilst there are other issues there, making this code more efficient doesn't hurt. (Bitbake rev: a4a72b7edb368f352784c856a647236a887010dd) Signed-off-by: Richard Purdie --- bitbake/bin/bitbake-worker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker index e8073f2ac3..a8a9660c5f 100755 --- a/bitbake/bin/bitbake-worker +++ b/bitbake/bin/bitbake-worker @@ -105,7 +105,7 @@ def worker_flush(worker_queue): if not worker_queue.empty(): worker_queue_int.extend(worker_queue.get()) written = os.write(worker_pipe, worker_queue_int) - worker_queue_int = worker_queue_int[written:] + del worker_queue_int[0:written] except (IOError, OSError) as e: if e.errno != errno.EAGAIN and e.errno != errno.EPIPE: raise