Rev 4415: Simply add min_gdfo to the pyrex search func in http://bazaar.launchpad.net/~jameinel/bzr/vila/gdfo-heads

John Arbash Meinel john at arbash-meinel.com
Wed Jun 17 15:41:07 BST 2009


At http://bazaar.launchpad.net/~jameinel/bzr/vila/gdfo-heads

------------------------------------------------------------
revno: 4415
revision-id: john at arbash-meinel.com-20090617144058-lfn4u111x6cn3ihr
parent: v.ladeuil+lp at free.fr-20090617123221-ijscdmxhxds026c0
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: gdfo-heads
timestamp: Wed 2009-06-17 09:40:58 -0500
message:
  Simply add min_gdfo to the pyrex search func
-------------- next part --------------
=== modified file 'bzrlib/_known_graph_pyx.pyx'
--- a/bzrlib/_known_graph_pyx.pyx	2009-06-12 20:21:08 +0000
+++ b/bzrlib/_known_graph_pyx.pyx	2009-06-17 14:40:58 +0000
@@ -502,7 +502,7 @@
     cdef int _process_parent(self, _KnownGraphNode node,
                              _KnownGraphNode parent_node,
                              candidate_nodes, dom_to_node,
-                             queue, int *replace_item) except -1:
+                             queue, int *replace_item, min_gdfo) except -1:
         """Process the parent of a node, seeing if we need to walk it."""
         cdef PyObject *maybe_candidate
         cdef PyObject *maybe_node
@@ -524,6 +524,9 @@
                 if maybe_candidate != NULL:
                     candidate_nodes.pop(dom_child_node.key)
                     return 0
+        if parent_node.gdfo < min_gdfo:
+            # Do not enque this node, it is too old
+            return 0
         if parent_node.ancestor_of is None:
             # This node hasn't been walked yet, so just project node's ancestor
             # info directly to parent_node, and enqueue it for later processing
@@ -554,12 +557,17 @@
 
         queue = []
         pos = 0
+        min_gdfo = None
         while PyDict_Next(candidate_nodes, &pos, NULL, &temp_node):
             node = <_KnownGraphNode>temp_node
             assert node.ancestor_of is None
             node.ancestor_of = (node.key,)
             PyList_Append(queue, (-node.gdfo, node))
             PyList_Append(self._to_cleanup, node)
+            if min_gdfo is None:
+                min_gdfo = node.gdfo
+            elif node.gdfo < min_gdfo:
+                min_gdfo = node.gdfo
         heapify(queue)
         # These are nodes that we determined are 'common' that we are no longer
         # walking
@@ -599,12 +607,14 @@
                 # We know that there is nothing between here and the tail
                 # that is interesting, so skip to the end
                 self._process_parent(node, node.linear_dominator_node,
-                                     candidate_nodes, dom_to_node, queue, &replace_item)
+                                     candidate_nodes, dom_to_node, queue,
+                                     &replace_item, min_gdfo)
             else:
                 for pos from 0 <= pos < PyTuple_GET_SIZE(node.parents):
                     parent_node = _get_parent(node.parents, pos)
                     self._process_parent(node, parent_node, candidate_nodes,
-                                         dom_to_node, queue, &replace_item)
+                                         dom_to_node, queue, &replace_item,
+                                         min_gdfo)
         for pos from 0 <= pos < PyList_GET_SIZE(self._to_cleanup):
             node = _get_list_node(self._to_cleanup, pos)
             node.ancestor_of = None



More information about the bazaar-commits mailing list