From patchwork Tue Apr 2 21:52:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [5,of,6,V2] scmutil.addremove: stop sorting all walk results From: Siddharth Agarwal X-Patchwork-Id: 1251 Message-Id: <5e6ff315d0f41c660c99.1364939577@sid0x220> To: mercurial-devel@selenic.com Date: Tue, 02 Apr 2013 14:52:57 -0700 # HG changeset patch # User Siddharth Agarwal # 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. 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):