serialize_tasks: minimize nodes in runtime cycles
authorZac Medico <zmedico@gentoo.org>
Sat, 11 Jun 2011 06:25:46 +0000 (23:25 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 11 Jun 2011 06:25:46 +0000 (23:25 -0700)
When gathering the nodes belonging to a runtime cycle, we want to
minimize the number of nodes gathered, since this tends to produce
a more optimal merge order. Ignoring all medium_soft deps serves
this purpose.

pym/_emerge/depgraph.py

index 5ad19e885004fd63ecf80911136d923be1228b7b..5dda22246eb45ba99677b062574544cbdce84e7f 100644 (file)
@@ -5010,36 +5010,36 @@ class depgraph(object):
                                        mergeable_nodes = set(nodes)
                                        if prefer_asap and asap_nodes:
                                                nodes = asap_nodes
-                                       for i in range(priority_range.SOFT,
-                                               priority_range.MEDIUM_SOFT + 1):
-                                               ignore_priority = priority_range.ignore_priority[i]
-                                               for node in nodes:
-                                                       if not mygraph.parent_nodes(node):
-                                                               continue
-                                                       selected_nodes = set()
-                                                       if gather_deps(ignore_priority,
-                                                               mergeable_nodes, selected_nodes, node):
-                                                               # When selecting asap_nodes, we need to ensure
-                                                               # that we don't selected a large runtime cycle
-                                                               # that is obviously sub-optimal. This will be
-                                                               # obvious if any of the non-asap selected_nodes
-                                                               # is a leaf node when medium_soft deps are
-                                                               # ignored.
-                                                               if prefer_asap and asap_nodes and \
-                                                                       len(selected_nodes) > 1:
-                                                                       for node in selected_nodes.difference(
-                                                                               asap_nodes):
-                                                                               if not mygraph.child_nodes(node,
-                                                                                       ignore_priority =
-                                                                                       DepPriorityNormalRange.ignore_medium_soft):
-                                                                                       selected_nodes = None
-                                                                                       break
-                                                               if selected_nodes:
-                                                                       break
-                                                       else:
-                                                               selected_nodes = None
-                                               if selected_nodes:
-                                                       break
+                                       # When gathering the nodes belonging to a runtime cycle,
+                                       # we want to minimize the number of nodes gathered, since
+                                       # this tends to produce a more optimal merge order.
+                                       # Ignoring all medium_soft deps serves this purpose.
+                                       ignore_priority = priority_range.ignore_medium_soft
+                                       for node in nodes:
+                                               if not mygraph.parent_nodes(node):
+                                                       continue
+                                               selected_nodes = set()
+                                               if gather_deps(ignore_priority,
+                                                       mergeable_nodes, selected_nodes, node):
+                                                       # When selecting asap_nodes, we need to ensure
+                                                       # that we don't selected a large runtime cycle
+                                                       # that is obviously sub-optimal. This will be
+                                                       # obvious if any of the non-asap selected_nodes
+                                                       # is a leaf node when medium_soft deps are
+                                                       # ignored.
+                                                       if prefer_asap and asap_nodes and \
+                                                               len(selected_nodes) > 1:
+                                                               for node in selected_nodes.difference(
+                                                                       asap_nodes):
+                                                                       if not mygraph.child_nodes(node,
+                                                                               ignore_priority =
+                                                                               DepPriorityNormalRange.ignore_medium_soft):
+                                                                               selected_nodes = None
+                                                                               break
+                                                       if selected_nodes:
+                                                               break
+                                               else:
+                                                       selected_nodes = None
 
                                        if prefer_asap and asap_nodes and not selected_nodes:
                                                # We failed to find any asap nodes to merge, so ignore