aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2024-02-10 22:34:32 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-02-13 13:52:08 +0000
commit8b332c16a7b6b85c5cbe1919dd8cae45fda6adf9 (patch)
tree6774cdb09a3dd2e2698df4031567383bd170a914
parentc4519b542702ba25023e53d77b275a6fa571ec50 (diff)
downloadbitbake-8b332c16a7b6b85c5cbe1919dd8cae45fda6adf9.tar.gz
runqueue: Optimise taskname lookups in next_buildable_task
A quick profile of bitbake world showed 147 million calls to taskname_from_tid(). The next_buildable_task function is performance senstive so move the call inside the if block to reduce the number of calls and speed the code up. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/runqueue.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
index c8392346a..95cab5132 100644
--- a/lib/bb/runqueue.py
+++ b/lib/bb/runqueue.py
@@ -270,11 +270,11 @@ class RunQueueScheduler(object):
best = None
bestprio = None
for tid in buildable:
- taskname = taskname_from_tid(tid)
- if taskname in skip_buildable and skip_buildable[taskname] >= int(self.skip_maxthread[taskname]):
- continue
prio = self.rev_prio_map[tid]
if bestprio is None or bestprio > prio:
+ taskname = taskname_from_tid(tid)
+ if taskname in skip_buildable and skip_buildable[taskname] >= int(self.skip_maxthread[taskname]):
+ continue
stamp = self.stamps[tid]
if stamp in self.rq.build_stamps.values():
continue