revset: prefetch method in "parents"
As already demonstrated, saving attribute lookup gains us some minor but
noticeable performance improvements.
revset #0: parents(all())
before) 0.024169
after ) 0.022756 94%
--- a/mercurial/revset.py Wed Jul 01 13:14:03 2015 -0700
+++ b/mercurial/revset.py Thu Jul 02 23:46:18 2015 -0700
@@ -1478,11 +1478,13 @@
else:
ps = set()
cl = repo.changelog
+ up = ps.update
+ parentrevs = cl.parentrevs
for r in getset(repo, fullreposet(repo), x):
if r is None:
- ps.update(p.rev() for p in repo[r].parents())
+ up(p.rev() for p in repo[r].parents())
else:
- ps.update(cl.parentrevs(r))
+ up(parentrevs(r))
ps -= set([node.nullrev])
return subset & ps