From 49a36dd19d8b8a2ec55b476610373dfb46e1e8cf Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 14 Nov 2006 10:23:27 +0000 Subject: [PATCH] taskqueue/runqueue.py: Remove matches_in_list and both_contain functions and use tasks_lookup instead - 33% speedup for world runqueue calculation --- lib/bb/runqueue.py | 5 +---- lib/bb/taskdata.py | 25 ------------------------- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py index af7279b..d38cf19 100644 --- a/lib/bb/runqueue.py +++ b/lib/bb/runqueue.py @@ -199,10 +199,7 @@ class RunQueue: if fnid in taskData.failed_fnids: continue - fnids = taskData.matches_in_list(self.runq_fnid, fnid) - tasks = taskData.matches_in_list(self.runq_task, target[1]) - - listid = taskData.both_contain(fnids, tasks) + listid = taskData.tasks_lookup[fnid][target[1]] mark_active(listid, 1) diff --git a/lib/bb/taskdata.py b/lib/bb/taskdata.py index 1dcffca..f3dc02c 100644 --- a/lib/bb/taskdata.py +++ b/lib/bb/taskdata.py @@ -53,31 +53,6 @@ class TaskData: self.abort = abort - def matches_in_list(self, data, substring): - """ - Return a list of the positions of substring in list data - """ - matches = [] - start = 0 - while 1: - try: - start = data.index(substring, start) - except ValueError: - return matches - matches.append(start) - start = start + 1 - - def both_contain(self, list1, list2): - """ - Return the items present in both list1 and list2 - """ - matches = [] - for data in list1: - if data in list2: - return data - return None - - def getbuild_id(self, name): """ Return an ID number for the build target name. -- 2.7.4