[PATCH 4 of 7] scmutil: speed up new-style range extension
Matt Mackall
mpm at selenic.com
Tue Jun 19 23:59:12 UTC 2012
On Mon, 2012-06-04 at 15:25 -0700, Bryan O'Sullivan wrote:
> # HG changeset patch
> # User Bryan O'Sullivan <bryano at fb.com>
> # Date 1338848634 25200
> # Node ID 115c3e5c708813a9800dfe4938a7c9202a4d00ba
> # Parent 40aa5fcf8bef8a1336caf95848282bc9ac9a7002
> scmutil: speed up new-style range extension
>
> This improves perfrevset performance by 10% for 2222::33333 on a
> kernel repo.
This refactoring seems independent of your other changes? Can we have it
first?
> diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
> --- a/mercurial/scmutil.py
> +++ b/mercurial/scmutil.py
> @@ -586,10 +586,9 @@ def revrange(repo, revs):
>
> # fall through to new-style queries if old-style fails
> m = revset.match(repo.ui, spec)
> - for r in m(repo, revset.revsubset(repo)):
> - if r not in seen:
> - l.append(r)
> - seen.update(l)
> + dl = [r for r in m(repo, revset.revsubset(repo)) if r not in seen]
> + l.extend(dl)
> + seen.update(dl)
>
> return l
>
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list