revset optimizer: branch() is not necessarily cheaper than outgoing()
Greg Ward
greg at gerg.ca
Tue Aug 31 10:52:12 CDT 2010
A small experiment with revset. First, without touching the code:
$ hg log -r "outgoing(<localrepo>) & branch(<branch>)" --time
[...]
Time: real 40.150 secs (user 37.950+0.000 sys 0.430+0.000)
Incidentally, "hg log -b <branch>" takes about 30 sec for me.
Now hack revset.py to remove the penalty for outgoing():
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -545,7 +545,7 @@
wa, ta = optimize(x[2], small)
if f in "grep date user author keyword branch file":
w = 10 # slow
- elif f in "modifies adds removes outgoing":
+ elif f in "modifies adds removes":
w = 30 # slower
elif f == "contains":
w = 100 # very slow
and run the same command again:
$ hg log -r "outgoing(<localrepo>) & branch(<branch>)" --time
Time: real 4.890 secs (user 4.580+0.000 sys 0.160+0.000)
Much better -- about what I expected in the first place. "hg outgoing
<localrepo>" takes about 3.7 sec for me.
Thoughts:
* for a large repo, queries that read the whole changelog (grep, date,
user, branch, etc.) are pretty costly -- more costly than a typical
outgoing() query that finds only tens or hundreds of changesets
* outgoing() vs a local repo is almost certainly cheaper than outgoing()
over ssh or http -- perhaps the optimizer should take that into account
Greg
More information about the Mercurial-devel
mailing list