# HG changeset patch # User Alexis S. L. Carvalho # Date 2006-10-28 23:21:52 # Node ID 736a78469a8579c63132fe74475b5fe40f53359e # Parent c141d07198b9d8f5e57fa5d7787c6f59add2c85b 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. diff --git a/mercurial/commands.py b/mercurial/commands.py --- 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