[PATCH V2] graphmod: compute slow revset query once prior to reachableroots (issue4782)
Augie Fackler
raf at durin42.com
Tue Sep 8 12:03:48 CDT 2015
On Wed, Sep 09, 2015 at 12:22:18AM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1441720844 -32400
> # Tue Sep 08 23:00:44 2015 +0900
> # Node ID 5c20f2034fffbafd406c0e4b1e7bbef9b3973965
> # Parent 2f77cf0385ace2539f313da8132e05d03841d846
> graphmod: compute slow revset query once prior to reachableroots (issue4782)
queued, but should this be on stable rather than default?
(it's on default for now)
>
> Because revsets query is evaluated lazily, "list(revs)" may take long for
> complicated query. So we shouldn't iterate revs many times. This patch is the
> easiest workaround for the issue4782. We could introduce more aggressive
> caching, but it wouldn't be as fast as the simple baseset operation.
>
> Gregory Szorc said "this makes `hg wip` on my Firefox clone ~4x faster than
> 3.5.1 (~6.5s to ~1.5s). This is after a regression in @ to ~45s."
>
> diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py
> --- a/mercurial/graphmod.py
> +++ b/mercurial/graphmod.py
> @@ -260,6 +260,10 @@ def dagwalker(repo, revs):
> for mpar in mpars:
> gp = gpcache.get(mpar)
> if gp is None:
> + # precompute slow query as we know reachableroots() goes
> + # through all revs (issue4782)
> + if not isinstance(revs, revset.baseset):
> + revs = revset.baseset(revs)
> gp = gpcache[mpar] = revset.reachableroots(repo, revs, [mpar])
> if not gp:
> parents.append(mpar)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list