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