diff mbox series

[2/2] runqueue: Fix scenetask processing performance issue

Message ID 20241129221002.770402-2-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit 923c19b9713e398d8e66e6d4422dfd4c18a03486
Headers show
Series [1/2] runqueue: Optimise setscene loop processing | expand

Commit Message

Richard Purdie Nov. 29, 2024, 10:10 p.m. UTC
Analysis shows that "bitbake core-image-ptest-all" spends a lot of
time in scenequeue_updatecounters and much of it is rebuilding a set
which doens't change. Reorder the code to avoid that performance
glitch.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/runqueue.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
index 6457726d96..ffb2d28494 100644
--- a/lib/bb/runqueue.py
+++ b/lib/bb/runqueue.py
@@ -2771,8 +2771,12 @@  class RunQueueExecute:
                 logger.debug2("%s was unavailable and is a hard dependency of %s so skipping" % (task, dep))
                 self.sq_task_failoutright(dep)
                 continue
+
+        # For performance, only compute allcovered once if needed
+        if self.sqdata.sq_deps[task]:
+            allcovered = self.scenequeue_covered | self.scenequeue_notcovered
         for dep in sorted(self.sqdata.sq_deps[task]):
-            if self.sqdata.sq_revdeps[dep].issubset(self.scenequeue_covered | self.scenequeue_notcovered):
+            if self.sqdata.sq_revdeps[dep].issubset(allcovered):
                 if dep not in self.sq_buildable:
                     self.sq_buildable.add(dep)