]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bb/ui: store_dependency_information optimization
authorMarius Avram <marius.avram@intel.com>
Tue, 18 Feb 2014 14:39:24 +0000 (16:39 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 9 Mar 2014 19:22:34 +0000 (12:22 -0700)
This optimization is in support of the bug #5485. The function called
at the beginning of every build: store_dependency_information was taking
approximately 20sec and it was delaying the arrival of events from the
event queue. The change minimizes the calls to _save_a_task(),
reducing the time to half.

Signed-off-by: Marius Avram <marius.avram@intel.com>
lib/bb/ui/buildinfohelper.py

index a0f10952f0192736250abaed8cd1ef77819a6d9a..54f6c4ebe8372374852ef08971e7d1c70d8da352 100644 (file)
@@ -612,11 +612,21 @@ class BuildInfoHelper(object):
             task_info['task_name'] = taskname
             task_obj = self.orm_wrapper.get_update_task_object(task_info)
             return task_obj
+        # create tasks
+        tasks = {}
+        for taskdesc in event._depgraph['tdepends']:
+            tasks[taskdesc] = _save_a_task(taskdesc)
 
+        # create dependencies between tasks
         for taskdesc in event._depgraph['tdepends']:
-            target = _save_a_task(taskdesc)
-            for taskdesc1 in event._depgraph['tdepends'][taskdesc]:
-                dep = _save_a_task(taskdesc1)
+            target = tasks[taskdesc]
+            for taskdep in event._depgraph['tdepends'][taskdesc]:
+                if taskdep not in tasks:
+                    # Fetch tasks info is not collected previously
+                    dep = _save_a_task(taskdep)
+                else:
+                    dep = tasks[taskdep]
                 Task_Dependency.objects.get_or_create( task = target, depends_on = dep )
 
     def store_build_package_information(self, event):