revset: changed __add__ methods on lazy sets to return addsets (issue4191)
Performance Benchmarking:
$ hg --time log --graph --style compact --limit 6 -r 'sort((::. or bookmark()
or heads(public())), "-rev")'
time: real 1.540 secs (user 1.510+0.000 sys 0.020+0.000)
$ ./hg --time log --graph --style compact --limit 6 -r 'sort((::. or
bookmark() or heads(public())), "-rev")'
time: real 1.240 secs (user 1.190+0.000 sys 0.040+0.010)
--- a/mercurial/revset.py Fri Mar 07 13:48:31 2014 -0800
+++ b/mercurial/revset.py Fri Mar 07 14:06:49 2014 -0800
@@ -2236,14 +2236,7 @@
return lazyset(self, lambda r: r not in x)
def __add__(self, x):
- def iterates():
- for r in self:
- yield r
- for r in x:
- if r not in self:
- yield r
-
- return lazyset(generatorset(iterates()))
+ return lazyset(addset(self, x))
def __nonzero__(self):
for r in self:
@@ -2476,14 +2469,7 @@
return orderedlazyset(self, lambda r: r not in x, ascending=False)
def __add__(self, x):
- def iterates():
- for r in self:
- yield r
- for r in x:
- if r not in self:
- yield r
-
- return lazyset(generatorset(iterates()))
+ return lazyset(addset(self, x))
def __len__(self):
if not self._hiddenrevs: