[PATCH 1 of 1] dirstate: optimisation of walk

Matt Mackall mpm at selenic.com
Thu May 14 10:37:56 CDT 2009


On Thu, May 14, 2009 at 02:59:46PM +0000, Simon Heimberg wrote:
> # HG changeset patch
> # User Simon Heimberg <simohe at besonet.ch>
> # Date 1242291045 -7200
> # Node ID 635197d4f31e44206169314755a16e0fcc835acf
> # Parent  7190bdb6ba8c5fcedf9efa61d31cbeca3ae686cb
> dirstate: optimisation of walk
> 
> Only execute step 3 when it is necessary. Skip it when nothing will match or all
> matches have been found in step 1.
> Find more matches in step 1.
> Little optimisation by using matchfn() instead of match() in step 3.
> Little optimisation in match by using self.exact, which uses a set.
> The changes in match are for detecting the functions in in dirstate.

Too many things in one patch, can't be properly reviewed. I recommend
you use the perf extension in contrib rather than timeit and report
some numbers.

I'd prefer you find some other way to distinguish between match types;
util.always and never are slated for destruction.

> diff -r 7190bdb6ba8c -r 635197d4f31e mercurial/dirstate.py
> --- a/mercurial/dirstate.py	Fre Mai 08 17:53:22 2009 +0200
> +++ b/mercurial/dirstate.py	Don Mai 14 10:50:45 2009 +0200
> @@ -484,6 +484,10 @@
>          join = self._join
>          work = []
>          wadd = work.append
> +        dostep3 = match.anypats() or matchfn == util.always
> +        onlystep1 = matchfn == match.exact or matchfn == util.never
> +        if onlystep1:
> +            dirignore = util.always
>

The meaning of onlystep1 is unclear here. You don't use it until step 3?

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial-devel mailing list