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

login
register
mail settings
Submitter Siddharth Agarwal
Date April 2, 2013, 7:36 p.m.
Message ID <ad7616f0d55499fe981c.1364931397@sid0x220>
Download mbox | patch
Permalink /patch/1245/
State Superseded
Commit 835e9dfd1e492b77339aec92d1690b4462d5782d
Headers show

Comments

Siddharth Agarwal - April 2, 2013, 7:36 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1364925478 25200
#      Tue Apr 02 10:57:58 2013 -0700
# Node ID ad7616f0d55499fe981c287827f4839438dec6d2
# Parent  2acf89d6d8f2687388af6dc219921795537e7ccb
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.02 seconds to 1.99.

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]
     dget = repo.dirstate._map.get
     walkresults = repo.dirstate.walk(m, sorted(ctx.substate), True, False)
-    for abs in walkresults:
-        st = walkresults[abs]
+    for abs, st in walkresults.iteritems():
         dstate = dget(abs, ('?',))[0]
         if dstate == '?' and audit_path.check(abs):
             unknown.append(abs)