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

login
register
mail settings
Submitter Siddharth Agarwal
Date April 2, 2013, 7:36 p.m.
Message ID <2acf89d6d8f2687388af.1364931396@sid0x220>
Download mbox | patch
Permalink /patch/1244/
State Superseded
Commit 887b75fda1695b2690220913e8ffd0a362aaec18
Headers show

Comments

Siddharth Agarwal - April 2, 2013, 7:36 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@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.

Patch

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):