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
--- 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: