Mercurial > hg
changeset 20587:cb18fe3461b1
revset: changed spanset __add__ implementation to work lazily
$ time hg log -qr "first(0:tip or draft())"
...
real 0m1.032s
user 0m0.841s
sys 0m0.179s
$ time ./hg log -qr "first(0:tip or draft())"
...
real 0m0.378s
user 0m0.291s
sys 0m0.085s
author | Lucas Moscovicz <lmoscovicz@fb.com> |
---|---|
date | Thu, 13 Feb 2014 09:18:16 -0800 |
parents | 2d52f37937b0 |
children | 710c2755e66a |
files | mercurial/revset.py |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revset.py Thu Feb 13 09:00:25 2014 -0800 +++ b/mercurial/revset.py Thu Feb 13 09:18:16 2014 -0800 @@ -2311,8 +2311,14 @@ return lazyset(self, lambda r: r not in x) def __add__(self, x): - l = baseset(self) - return l + baseset(x) + def iterates(): + for r in self: + yield r + for r in x: + if r not in self: + yield r + + return lazyset(generatorset(iterates())) def __len__(self): if not self._hiddenrevs: