baseset: drop custom __sub__ method
authorPierre-Yves David <pierre-yves.david@fb.com>
Thu, 09 Oct 2014 04:29:18 -0700
changeset 22857 88e8a18329d3
parent 22856 c1546d7400ef
child 22858 d7cedb32a8ab
baseset: drop custom __sub__ method This add method is enforcing non-laziness, disabling multiple optimisations. Benchmarks do not spot any significant difference but real usecase may. This will also be important for further improvements to addset later in this series.
mercurial/revset.py
--- a/mercurial/revset.py	Thu Oct 09 04:27:25 2014 -0700
+++ b/mercurial/revset.py	Thu Oct 09 04:29:18 2014 -0700
@@ -2369,19 +2369,6 @@
     def __len__(self):
         return len(self._list)
 
-    def __sub__(self, other):
-        """Returns a new object with the substraction of the two collections.
-
-        This is part of the mandatory API for smartset."""
-        # If we are operating on 2 baseset, do the computation now since all
-        # data is available. The alternative is to involve a filteredset, which
-        # may be slow.
-        if isinstance(other, baseset):
-            other = other.set()
-            return baseset([x for x in self if x not in other])
-
-        return self.filter(lambda x: x not in other)
-
     def isascending(self):
         """Returns True if the collection is ascending order, False if not.