[PATCH stable] bundle: fix performance regression when bundling file changes (issue4031)

Antoine Pitrou solipsis at pitrou.net
Sat Sep 7 14:23:44 CDT 2013


# HG changeset patch
# User Antoine Pitrou <solipsis at pitrou.net>
# Date 1378581600 -7200
#      Sat Sep 07 21:20:00 2013 +0200
# Branch stable
# Node ID ca847f0aa6821652a2d58eb559adb5112e99249e
# Parent  e90c37d7d48c7cc9801c91071942f4119bbe380c
bundle: fix performance regression when bundling file changes (issue4031)

Somewhere before 2.7, a change was committed that entailed a large
performance regression when bundling (and therefore remote cloning)
repositories.  For each file in the repository, it would recompute
the set of needed changesets even though it is the same for all files.
This computation would dominate bundle runtimes according to profiler
output (by 10x or more).

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -354,11 +354,11 @@
         progress(msgbundling, None)
 
         mfs.clear()
+        needed = set(cl.rev(x) for x in clnodes)
 
         def linknodes(filerevlog, fname):
             if fastpathlinkrev:
                 ln, llr = filerevlog.node, filerevlog.linkrev
-                needed = set(cl.rev(x) for x in clnodes)
                 def genfilenodes():
                     for r in filerevlog:
                         linkrev = llr(r)


More information about the Mercurial-devel mailing list