Mercurial > hg
changeset 20452:a685d9870eb5
revset: added lazyset implementation to desc revset
Performance benchmarking:
$ time hg log -qr "first(desc(hg))"
changeset: 0:9117c6561b0b
real 0m2.210s
user 0m2.158s
sys 0m0.049s
$ time ./hg log -qr "first(desc(hg))"
changeset: 0:9117c6561b0b
real 0m0.171s
user 0m0.131s
sys 0m0.035s
author | Lucas Moscovicz <lmoscovicz@fb.com> |
---|---|
date | Thu, 30 Jan 2014 15:39:56 -0800 |
parents | ac7cebf45eb4 |
children | 6aa7dcae6bd8 |
files | mercurial/revset.py |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revset.py Mon Feb 03 16:15:25 2014 -0800 +++ b/mercurial/revset.py Thu Jan 30 15:39:56 2014 -0800 @@ -590,12 +590,12 @@ """ # i18n: "desc" is a keyword ds = encoding.lower(getstring(x, _("desc requires a string"))) - l = [] - for r in subset: - c = repo[r] - if ds in encoding.lower(c.description()): - l.append(r) - return baseset(l) + + def matches(x): + c = repo[x] + return ds in encoding.lower(c.description()) + + return lazyset(subset, matches) def _descendants(repo, subset, x, followfirst=False): args = getset(repo, baseset(repo), x)