diff options
| author | Etienne Cordonnier <ecordonnier@snap.com> | 2023-09-22 10:51:46 +0200 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2023-10-18 05:13:24 -1000 |
| commit | 3a3afebf41077e097150bc33f3e292eed929ba11 (patch) | |
| tree | 6e3ce05bef44a71f69398bca954a7959a974c69d /scripts/lib/devtool/package.py | |
| parent | 222be3e3b989cb32cd8e3601615fac276c04c3ea (diff) | |
| download | poky-3a3afebf41077e097150bc33f3e292eed929ba11.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: 9993a89e5b97dda5f3657e5a7cc3a4fa94ff7111)
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'scripts/lib/devtool/package.py')
0 files changed, 0 insertions, 0 deletions
