[MERGE] Updated graph.heads optimisation.
Robert Collins
robertc at robertcollins.net
Mon Oct 22 21:09:47 BST 2007
On Mon, 2007-10-22 at 14:54 -0500, John Arbash Meinel wrote:
>
> + # 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
Well, it would be
if len(candidate_heads) == 1:
# We're done
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.
It's a good thought, and worth adding.
-Rob
--
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20071023/83246b51/attachment.pgp
More information about the bazaar
mailing list