Patchwork [2,of,6,V2] scmutil.addremove: pull repo.dirstate fetch out of the loop

login
register
mail settings
Submitter Siddharth Agarwal
Date April 2, 2013, 9:52 p.m.
Message ID <4535ebeae4e69079ed7e.1364939574@sid0x220>
Download mbox | patch
Permalink /patch/1248/
State Accepted
Commit ec91b66e8965e4b4655e1ec49c41301de297a8e1
Headers show

Comments

Siddharth Agarwal - April 2, 2013, 9:52 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1364939215 25200
#      Tue Apr 02 14:46:55 2013 -0700
# Node ID 4535ebeae4e69079ed7e0eb1f61ecffe372671be
# Parent  d723353c8a0ab2ced8606014abee43aa0b1e3fa4
scmutil.addremove: pull repo.dirstate fetch out of the loop

On a large repository with 170,000 files, this speeds up perfaddremove from
2.78 seconds to 2.40.
Bryan O'Sullivan - April 3, 2013, 4:29 p.m.
On Tue, Apr 2, 2013 at 2:52 PM, Siddharth Agarwal <sid0@fb.com> wrote:

> scmutil.addremove: pull repo.dirstate fetch out of the loop
>

I've queued 2 through 6, thanks.

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -676,10 +676,11 @@  def addremove(repo, pats=[], opts={}, dr
     m.bad = lambda x, y: rejected.append(x)
 
     ctx = repo[None]
-    walkresults = repo.dirstate.walk(m, sorted(ctx.substate), True, False)
+    dirstate = repo.dirstate
+    walkresults = dirstate.walk(m, sorted(ctx.substate), True, False)
     for abs in sorted(walkresults):
         st = walkresults[abs]
-        dstate = repo.dirstate[abs]
+        dstate = dirstate[abs]
         if dstate == '?' and audit_path.check(abs):
             unknown.append(abs)
             if repo.ui.verbose or not m.exact(abs):