changeset 20695:d99fcf4483f8

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)
author Lucas Moscovicz <lmoscovicz@fb.com>
date Fri, 07 Mar 2014 14:06:49 -0800
parents 621c94378d0d
children 77ab0abb08a0
files mercurial/revset.py
diffstat 1 files changed, 2 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- 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: