Patchwork addremove: don't do full walks

login
register
mail settings
Submitter Siddharth Agarwal
Date Sept. 5, 2013, 1:48 a.m.
Message ID <c11bcb87c9338b29a67f.1378345686@dev1091.prn1.facebook.com>
Download mbox | patch
Permalink /patch/2332/
State Accepted
Commit 1d07bf106c2ad1c7ef5e257e754ca8d858bd04b0
Headers show

Comments

Siddharth Agarwal - Sept. 5, 2013, 1:48 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1378345375 25200
#      Wed Sep 04 18:42:55 2013 -0700
# Node ID c11bcb87c9338b29a67fc6e260d50b9a18705994
# Parent  5e8173f8486bce989a7439bd8ca24078864a62d8
addremove: don't do full walks

Full walks are only necessary when the caller needs the list of clean files.
addremove by definition doesn't need them.

With this patch and an extension that produces a subset of results for
dirstate.walk when full is False, on a repository with over 200,000 files, hg
addremove drops from 2.8 seconds to 0.5.
Augie Fackler - Sept. 5, 2013, 3:51 p.m.
On Wed, Sep 04, 2013 at 06:48:06PM -0700, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1378345375 25200
> #      Wed Sep 04 18:42:55 2013 -0700
> # Node ID c11bcb87c9338b29a67fc6e260d50b9a18705994
> # Parent  5e8173f8486bce989a7439bd8ca24078864a62d8
> addremove: don't do full walks

queued, thanks

>
> Full walks are only necessary when the caller needs the list of clean files.
> addremove by definition doesn't need them.
>
> With this patch and an extension that produces a subset of results for
> dirstate.walk when full is False, on a repository with over 200,000 files, hg
> addremove drops from 2.8 seconds to 0.5.
>
> diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
> --- a/mercurial/scmutil.py
> +++ b/mercurial/scmutil.py
> @@ -755,7 +755,8 @@
>
>      ctx = repo[None]
>      dirstate = repo.dirstate
> -    walkresults = dirstate.walk(matcher, sorted(ctx.substate), True, False)
> +    walkresults = dirstate.walk(matcher, sorted(ctx.substate), True, False,
> +                                full=False)
>      for abs, st in walkresults.iteritems():
>          dstate = dirstate[abs]
>          if dstate == '?' and audit_path.check(abs):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -755,7 +755,8 @@ 
 
     ctx = repo[None]
     dirstate = repo.dirstate
-    walkresults = dirstate.walk(matcher, sorted(ctx.substate), True, False)
+    walkresults = dirstate.walk(matcher, sorted(ctx.substate), True, False,
+                                full=False)
     for abs, st in walkresults.iteritems():
         dstate = dirstate[abs]
         if dstate == '?' and audit_path.check(abs):