changeset 20262:cf450ee3f8f7

branchmap: stop useless rev -> node -> rev round trip We never use the node of new revisions unless in the very specific case of closed heads. So we can just use the revision number. So give another handfull of percent speedup.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Fri, 03 Jan 2014 16:44:23 -0800
parents 3fee302a48e6
children ea4996754d91
files mercurial/branchmap.py
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/branchmap.py	Tue Jan 15 20:04:12 2013 +0100
+++ b/mercurial/branchmap.py	Fri Jan 03 16:44:23 2014 -0800
@@ -230,17 +230,15 @@
         getbranchinfo = cl.branchinfo
         for r in revgen:
             branch, closesbranch = getbranchinfo(r)
-            node = cl.node(r)
-            newbranches.setdefault(branch, []).append(node)
+            newbranches.setdefault(branch, []).append(r)
             if closesbranch:
-                self._closednodes.add(node)
+                self._closednodes.add(cl.node(r))
         # if older branchheads are reachable from new ones, they aren't
         # really branchheads. Note checking parents is insufficient:
         # 1 (branch a) -> 2 (branch b) -> 3 (branch a)
-        for branch, newnodes in newbranches.iteritems():
+        for branch, newheadrevs in newbranches.iteritems():
             bheads = self.setdefault(branch, [])
             bheadrevs = [cl.rev(node) for node in bheads]
-            newheadrevs = [cl.rev(node) for node in newnodes]
             ctxisnew = bheadrevs and min(newheadrevs) > max(bheadrevs)
             # Remove duplicates - nodes that are in newheadrevs and are already
             # in bheadrevs.  This can happen if you strip a node whose parent