log: speed up hg log <file|folder>
This patch makes hg log <file|folder> faster by using changelog.readfiles
instead of changelog.read.
On our large repos for hg log <file|folder> -l5 operations that were taking:
- ~8s I see a 25% improvement
- ~15s, I see a 35% improvement
For recently modified folder/file, the difference is negligible as we don't
have to consider many revisions.
--- a/mercurial/revset.py Fri Dec 18 13:45:55 2015 -0800
+++ b/mercurial/revset.py Fri Dec 18 12:54:45 2015 -0800
@@ -1166,13 +1166,13 @@
# This directly read the changelog data as creating changectx for all
# revisions is quite expensive.
- getchangeset = repo.changelog.read
+ getfiles = repo.changelog.readfiles
wdirrev = node.wdirrev
def matches(x):
if x == wdirrev:
files = repo[x].files()
else:
- files = getchangeset(x)[3]
+ files = getfiles(x)
for f in files:
if m(f):
return True