[PATCH] revset-_ancestor: use & instead of filter
Augie Fackler
raf at durin42.com
Fri Oct 17 14:11:28 UTC 2014
On Thu, Oct 16, 2014 at 05:19:02PM -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at fb.com>
> # Date 1412107434 18000
> # Tue Sep 30 15:03:54 2014 -0500
> # Node ID cd1d993fd93096dbb7886b6cba28b57fff100b3b
> # Parent 840be5ca03e1db16ba994e55597771c418166c97
> revset-_ancestor: use & instead of filter
>
queued, thanks
>
> The & operation is more likely optimised.
>
> ::10
> before) wall 0.028189 comb 0.030000 user 0.030000 sys 0.000000 (best of 100)
> after) wall 0.001050 comb 0.000000 user 0.000000 sys 0.000000 (best of 2326)
>
> ::tip
> before) wall 0.081132 comb 0.080000 user 0.080000 sys 0.000000 (best of 100)
> after) wall 0.055418 comb 0.050000 user 0.050000 sys 0.000000 (best of 100)
>
> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -345,11 +345,11 @@ def ancestor(repo, subset, x):
> def _ancestors(repo, subset, x, followfirst=False):
> heads = getset(repo, spanset(repo), x)
> if not heads:
> return baseset()
> s = _revancestors(repo, heads, followfirst)
> - return subset.filter(s.__contains__)
> + return subset & s
>
> def ancestors(repo, subset, x):
> """``ancestors(set)``
> Changesets that are ancestors of a changeset in set.
> """
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list