[PATCH 5 of 6] scmutil.addremove: stop sorting all walk results

Siddharth Agarwal sid0 at fb.com
Tue Apr 2 14:36:36 CDT 2013


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1364924942 25200
#      Tue Apr 02 10:49:02 2013 -0700
# Node ID 2acf89d6d8f2687388af6dc219921795537e7ccb
# Parent  699722e60e7cd5aab766cb33e3152f1d8c44e9b3
scmutil.addremove: stop sorting all walk results

The only place where the order matters is in printing out added or removed
files. We already sort that set.

On a large repository with 170,000 files, this speeds up perfaddremove from
2.23 seconds to 2.02.

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -678,7 +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 sorted(walkresults):
+    for abs in walkresults:
         st = walkresults[abs]
         dstate = dget(abs, ('?',))[0]
         if dstate == '?' and audit_path.check(abs):


More information about the Mercurial-devel mailing list