[PATCH 4 of 7] scmutil: speed up new-style range extension

Matt Mackall mpm at selenic.com
Mon Jun 18 17:35:17 CDT 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 doesn't actually seem to depend on the new interval
magic?

> 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