Rev 4415: Feedback from John, 'seen' is a set(). in file:///home/vila/src/bzr/reviews/vila-better-heads/

Vincent Ladeuil v.ladeuil+lp at free.fr
Wed Jun 17 17:25:50 BST 2009


At file:///home/vila/src/bzr/reviews/vila-better-heads/

------------------------------------------------------------
revno: 4415
revision-id: v.ladeuil+lp at free.fr-20090617162550-uz7q6k8ber62y2r5
parent: v.ladeuil+lp at free.fr-20090617123221-ijscdmxhxds026c0
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: vila-better-heads
timestamp: Wed 2009-06-17 18:25:50 +0200
message:
  Feedback from John, 'seen' is a set().
  
  * bzrlib/_known_graph_py.py:
  (KnownGraph.heads): Make 'seen' a set() instead of a dict(), perf
  difference seems to be lost in the noise though :-/
-------------- next part --------------
=== modified file 'bzrlib/_known_graph_py.py'
--- a/bzrlib/_known_graph_py.py	2009-06-17 12:32:21 +0000
+++ b/bzrlib/_known_graph_py.py	2009-06-17 16:25:50 +0000
@@ -273,7 +273,7 @@
         except KeyError:
             pass
         # Let's compute the heads
-        seen = {}
+        seen = set()
         pending = []
         min_gdfo = None
         for node in candidate_nodes.values():
@@ -287,13 +287,13 @@
             if node_key in seen:
                 # node already appears in some ancestry
                 continue
-            seen[node_key] = True
+            seen.add(node_key)
             node = nodes[node_key]
             if node.gdfo <= min_gdfo:
                 continue
             if node.parent_keys: # protect against ghosts, jam, fixme ?
                 pending.extend(node.parent_keys)
-        heads = heads_key.difference(seen.keys())
+        heads = heads_key.difference(seen)
         if self.do_cache:
             self._known_heads[heads_key] = heads
         return heads



More information about the bazaar-commits mailing list