[MERGE] Updated graph.heads optimisation.

John Arbash Meinel john at arbash-meinel.com
Mon Oct 22 20:54:55 BST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Collins wrote:
> Herewith.
> 
+            # process found nodes
+            new_common = set()
+            for ancestor in ancestors:
+                if ancestor in candidate_heads:
+                    candidate_heads.remove(ancestor)
+                    del searchers[ancestor]
+                    if ancestor in active_searchers:
+                        del active_searchers[ancestor]

^- I was wondering...

If at the point you have removed all candidates but one, could you stop early,
and ignore all of the other cleanup?
Specifically just a check for:

candidate_heads.remove(ancestor)
if len(candidate_heads) <= 1:
  return candidate_heads

I'm not sure how much or how often it would be a win, but it seems like we do a
whole lot of book-keeping before we've finally cleaned up enough to return,
when all of that is just teardown that will go away with the garbage collector.

Just a thought. It may have little effect in practice.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHHQAOJdeBCYSNAAMRAomdAJ0RNtkanPg5MPm1p4jD5jaxOA4GMQCggq7n
2hS1q+vwdrdiT+44Zo1Zzhk=
=VFbN
-----END PGP SIGNATURE-----



More information about the bazaar mailing list