Patchwork [6,of,6,V2] scmutil.addremove: use iteritems on walk results

login
register
mail settings
Submitter Siddharth Agarwal
Date April 2, 2013, 9:52 p.m.
Message ID <448271b25c7b0e37afa6.1364939578@sid0x220>
Download mbox | patch
Permalink /patch/1252/
State Accepted
Commit 835e9dfd1e492b77339aec92d1690b4462d5782d
Headers show

Comments

Siddharth Agarwal - April 2, 2013, 9:52 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1364939450 25200
#      Tue Apr 02 14:50:50 2013 -0700
# Node ID 448271b25c7b0e37afa62de630822ff9c51bf51a
# Parent  5e6ff315d0f41c660c99111b04c5acf4d08a9271
scmutil.addremove: use iteritems on walk results

Now that we no longer sort all the walk results, using iteritems becomes
possible.

This is a relatively minor speedup: on a large repository with 170,000 files,
perfaddremove goes from 2.13 seconds to 2.10.

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -678,8 +678,7 @@  def addremove(repo, pats=[], opts={}, dr
     ctx = repo[None]
     dirstate = repo.dirstate
     walkresults = dirstate.walk(m, sorted(ctx.substate), True, False)
-    for abs in walkresults:
-        st = walkresults[abs]
+    for abs, st in walkresults.iteritems():
         dstate = dirstate[abs]
         if dstate == '?' and audit_path.check(abs):
             unknown.append(abs)