changeset 3571:736a78469a85

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.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sat, 28 Oct 2006 20:21:52 -0300
parents c141d07198b9
children fe03c9a476f6
files mercurial/commands.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -230,7 +230,13 @@ def walkchangerevs(ui, repo, pats, chang
             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