comparison mercurial/revset.py @ 22856:c1546d7400ef

baseset: drop custom __and__ method This add method is enforcing non-laziness, disabling multiple optimisations. Benchmarks do not spot any significant regression but real usecase may. This even gives some speedup in some cases: revset #15: min(0::) before) wall 0.001247 comb 0.000000 user 0.000000 sys 0.000000 (best of 1814) after) wall 0.000942 comb 0.000000 user 0.000000 sys 0.000000 (best of 2367) This will also be important for further improvement to addset later in this series.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 09 Oct 2014 04:27:25 -0700
parents b5492b6bc7e8
children 88e8a18329d3
comparison
equal deleted inserted replaced
22855:b5492b6bc7e8 22856:c1546d7400ef
2380 other = other.set() 2380 other = other.set()
2381 return baseset([x for x in self if x not in other]) 2381 return baseset([x for x in self if x not in other])
2382 2382
2383 return self.filter(lambda x: x not in other) 2383 return self.filter(lambda x: x not in other)
2384 2384
2385 def __and__(self, other):
2386 """Returns a new object with the intersection of the two collections.
2387
2388 This is part of the mandatory API for smartset."""
2389 return baseset([y for y in self if y in other])
2390
2391 def isascending(self): 2385 def isascending(self):
2392 """Returns True if the collection is ascending order, False if not. 2386 """Returns True if the collection is ascending order, False if not.
2393 2387
2394 This is part of the mandatory API for smartset.""" 2388 This is part of the mandatory API for smartset."""
2395 return self._ascending is not None and self._ascending 2389 return self._ascending is not None and self._ascending