diff options
author | Etienne Cordonnier <ecordonnier@snap.com> | 2023-09-20 09:41:48 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-09-22 07:45:47 +0100 |
commit | 46386988349e9247640841202165a92a9bd1db3c (patch) | |
tree | 01848a61db8b1333f6b0b45c30b7d0302e65ee79 /bitbake/lib/bb/codeparser.py | |
parent | 2a581252eae2c506237fb22f1f39fc26849b6431 (diff) | |
download | poky-46386988349e9247640841202165a92a9bd1db3c.tar.gz |
bitbake: bitbake-worker/runqueue: Avoid unnecessary bytes object copies
declaring queue=b"" creates an object of types bytes().
bytes() is an immutable object, and therefore doing "self.queue = self.queue + r"
creates a new object containing "self.queue" concatenated with "r".
On my test setup, we are passing 180MB of data of "workerdata" to the bitbake-worker,
so those copies significantly slow down the initialization of the bitbake-worker.
Rather use bytearray() which a mutable type, and use extend() to avoid copies.
In my test setup, byterray.extend() is 10.000 times faster than copying the queue,
for a queue size of 180MB.
(Bitbake rev: 2302b5316091dff189e6c3f546341b2274ed9d0a)
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/codeparser.py')
0 files changed, 0 insertions, 0 deletions