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

login
register
mail settings
Submitter Siddharth Agarwal
Date April 2, 2013, 9:52 p.m.
Message ID <5e6ff315d0f41c660c99.1364939577@sid0x220>
Download mbox | patch
Permalink /patch/1251/
State Accepted
Commit 887b75fda1695b2690220913e8ffd0a362aaec18
Headers show

Comments

Siddharth Agarwal - April 2, 2013, 9:52 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1364939431 25200
#      Tue Apr 02 14:50:31 2013 -0700
# Node ID 5e6ff315d0f41c660c99111b04c5acf4d08a9271
# Parent  6253706ef464e15fb371d64b6e2d4cc5d8424d9f
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.34 seconds to 2.13.

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