Rev 4407: Cache heads() results from dominator lookups. in http://bazaar.launchpad.net/~jameinel/bzr/1.16-better_heads

John Arbash Meinel john at arbash-meinel.com
Fri Jun 12 05:13:17 BST 2009


At http://bazaar.launchpad.net/~jameinel/bzr/1.16-better_heads

------------------------------------------------------------
revno: 4407
revision-id: john at arbash-meinel.com-20090612041307-jk38nrysmr78f5d0
parent: john at arbash-meinel.com-20090612041001-qqauzvhsb5z333gz
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.16-better_heads
timestamp: Thu 2009-06-11 23:13:07 -0500
message:
  Cache heads() results from dominator lookups.
-------------- next part --------------
=== modified file 'bzrlib/_known_graph_pyx.pyx'
--- a/bzrlib/_known_graph_pyx.pyx	2009-06-12 04:10:01 +0000
+++ b/bzrlib/_known_graph_pyx.pyx	2009-06-12 04:13:07 +0000
@@ -305,7 +305,7 @@
             node = <_KnownGraphNode>temp_node
             node.gdfo = 1
             PyList_Append(todo, (1, node))
-        heapify(todo)
+        # No need to heapify, because all tails have priority=1
         max_gdfo = len(self._nodes) + 1
         while PyList_GET_SIZE(todo) > 0:
             temp_tuple = PyList_GET_ITEM(todo, 0)
@@ -393,6 +393,10 @@
         # know the heads answer
         dom_lookup_key, heads = self._heads_from_dominators(candidate_nodes)
         if heads is not None:
+            if self.do_cache:
+                # This heads was not in the cache, or it would have been caught
+                # earlier, but the dom head *was*, so do the simple cache
+                PyDict_SetItem(self._known_heads, heads_key, heads)
             return heads
         heads = self._heads_from_candidate_nodes(candidate_nodes)
         if self.do_cache:



More information about the bazaar-commits mailing list