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

login
register
mail settings
Submitter Antoine Pitrou
Date Sept. 7, 2013, 7:23 p.m.
Message ID <ca847f0aa6821652a2d5.1378581824@fsol>
Download mbox | patch
Permalink /patch/2403/
State Accepted
Commit fd4f612f7cb6413940d4cf2052334cd23f60e042
Headers show

Comments

Antoine Pitrou - Sept. 7, 2013, 7:23 p.m.
# HG changeset patch
# User Antoine Pitrou <solipsis@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).

Patch

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)