log speedup: walkchangerevs: filter the files only if we need them
This speeds up hg log and significantly reduces memory usage (max RSS
goes from ~92MB to ~21MB on the kernel repo), since we no longer store
all the revisions in the cache.
--- a/mercurial/commands.py Sat Oct 28 23:05:57 2006 +0200
+++ b/mercurial/commands.py Sat Oct 28 20:21:52 2006 -0300
@@ -230,7 +230,13 @@
srevs = list(nrevs)
srevs.sort()
for rev in srevs:
- fns = fncache.get(rev) or filter(matchfn, change(rev)[3])
+ fns = fncache.get(rev)
+ if not fns:
+ def fns_generator():
+ for f in change(rev)[3]:
+ if matchfn(f):
+ yield f
+ fns = fns_generator()
yield 'add', rev, fns
for rev in nrevs:
yield 'iter', rev, None