[PATCH] revset-node: speedup by a few hundred fold

Augie Fackler raf at durin42.com
Fri Oct 17 08:55:09 CDT 2014


On Thu, Oct 16, 2014 at 07:01:05PM -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at fb.com>
> # Date 1413016760 25200
> #      Sat Oct 11 01:39:20 2014 -0700
> # Node ID 054db6453bb4259d5df4aca4aa5456a888d2da42
> # Parent  eaceb9c9e15a4fa0fa3efb53234782c56e4af9a6
> revset-node: speedup by a few hundred fold

Nice. Queued.

>
> Instead of checking all elements of the subset against a single rev, just check
> if this rev is in the subset. The old way was inherited from when the subset was
> a list.
>
> Non surprise, this provide massive speedup.
>
>
> id("d82e2223f132")
> before) wall 0.008205 comb 0.000000 user 0.000000 sys 0.000000 (best of 302)
> after)  wall 0.000069 comb 0.000000 user 0.000000 sys 0.000000 (best of 34518)
>
> revset #1: public() and id("d82e2223f132")
> before) wall 0.019763 comb 0.020000 user 0.020000 sys 0.000000 (best of 124)
> after)  wall 0.000101 comb 0.000000 user 0.000000 sys 0.000000 (best of 20130)
>
> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -1131,11 +1131,14 @@ def node_(repo, subset, x):
>          rn = None
>          pm = repo.changelog._partialmatch(n)
>          if pm is not None:
>              rn = repo.changelog.rev(pm)
>
> -    return subset.filter(lambda r: r == rn)
> +    if rn is None:
> +        return baseset()
> +    result = baseset([rn])
> +    return result & subset
>
>  def obsolete(repo, subset, x):
>      """``obsolete()``
>      Mutable changeset with a newer version."""
>      # i18n: "obsolete" is a keyword
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list