[PATCH] revset-only: use `subset &` instead of filtering

Augie Fackler raf at durin42.com
Fri Oct 17 09:11:05 CDT 2014


On Thu, Oct 16, 2014 at 05:37:22PM -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at fb.com>
> # Date 1412987298 25200
> #      Fri Oct 10 17:28:18 2014 -0700
> # Node ID 6e04ffe6221396653833e9a2e374c3b2b5b4ca49
> # Parent  cd1d993fd93096dbb7886b6cba28b57fff100b3b
> revset-only: use `subset &` instead of filtering

queued thanks

>
> The & version is more likely to be optimised.
>
> only(.)
> before) wall 0.003216 comb 0.000000 user 0.000000 sys 0.000000 (best of 768)
> after)  wall 0.001086 comb 0.000000 user 0.000000 sys 0.000000 (best of 2231)
>
> only(default, stable)
> before) wall 0.018469 comb 0.020000 user 0.020000 sys 0.000000 (best of 138)
> after)  wall 0.015888 comb 0.010000 user 0.010000 sys 0.000000 (best of 156)
>
> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -406,11 +406,11 @@ def only(repo, subset, x):
>              if not rev in descendants and not rev in include]
>      else:
>          exclude = getset(repo, spanset(repo), args[1])
>
>      results = set(ancestormod.missingancestors(include, exclude, cl.parentrevs))
> -    return filteredset(subset, results.__contains__)
> +    return subset & results
>
>  def bisect(repo, subset, x):
>      """``bisect(string)``
>      Changesets marked in the specified bisect status:
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list