aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/server
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-02 09:02:15 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-03 10:09:59 +0000
commitd654139a833127b16274dca0ccbbab7e3bb33ed0 (patch)
tree14cd46757ab9ded015516c9078fe9c341d9b9c68 /lib/bb/server
parentdfad69d4d8c894a5e1e2686023e41552de09bf3b (diff)
downloadbitbake-d654139a833127b16274dca0ccbbab7e3bb33ed0.tar.gz
lib/bb: Fix string concatination potential performance issues
Python scales badly when concatinating strings in loops. Most of these references aren't problematic but at least one (in data.py) is probably a performance issue as the issue is compounded as strings become large. The way to handle this in python is to create lists which don't reconstruct all the objects when appending to them. We may as well fix all the references since it stops them being copy/pasted into something problematic in the future. This patch was based on issues highligthted by a report from AWS Codeguru. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/server')
-rw-r--r--lib/bb/server/process.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py
index 8fdcc66dc..163661666 100644
--- a/lib/bb/server/process.py
+++ b/lib/bb/server/process.py
@@ -326,10 +326,10 @@ class ProcessServer():
if e.errno != errno.ENOENT:
raise
- msg = "Delaying shutdown due to active processes which appear to be holding bitbake.lock"
+ msg = ["Delaying shutdown due to active processes which appear to be holding bitbake.lock"]
if procs:
- msg += ":\n%s" % str(procs.decode("utf-8"))
- serverlog(msg)
+ msg.append(":\n%s" % str(procs.decode("utf-8")))
+ serverlog("".join(msg))
def idle_commands(self, delay, fds=None):
nextsleep = delay