From 3190cb83e2af195a464f669c5aa8aedbf795160e Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 27 Jun 2012 11:04:06 +0100 Subject: taskdata: Add gettask_id_fromfnid helper function This is like gettask_id but doesn't require translation of fnid -> fn first which the function then translates back. This gives a sizeable performance improvement since a significant number of lookups are avoided. Signed-off-by: Richard Purdie --- lib/bb/taskdata.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/bb/taskdata.py') diff --git a/lib/bb/taskdata.py b/lib/bb/taskdata.py index 8bc447c11..55cdde553 100644 --- a/lib/bb/taskdata.py +++ b/lib/bb/taskdata.py @@ -116,6 +116,16 @@ class TaskData: ids.append(self.tasks_lookup[fnid][task]) return ids + def gettask_id_fromfnid(self, fnid, task): + """ + Return an ID number for the task matching fnid and task. + """ + if fnid in self.tasks_lookup: + if task in self.tasks_lookup[fnid]: + return self.tasks_lookup[fnid][task] + + return None + def gettask_id(self, fn, task, create = True): """ Return an ID number for the task matching fn and task. -- cgit 1.2.3-korg