diff mercurial/revset.py @ 24459:7d369fae098e

revset: optimize "x & fullreposet" case If self is a smartset and other is a fullreposet, nothing should be necessary. A small win for trivial query in mozilla-central repo: revset #0: (0:100000) 0) wall 0.017211 comb 0.020000 user 0.020000 sys 0.000000 (best of 163) 1) wall 0.001324 comb 0.000000 user 0.000000 sys 0.000000 (best of 2160)
author Yuya Nishihara <yuya@tcha.org>
date Mon, 16 Mar 2015 17:11:25 +0900
parents 7d87f672d069
children dd5e56f08d13
line wrap: on
line diff
--- a/mercurial/revset.py	Mon Mar 16 18:36:53 2015 +0900
+++ b/mercurial/revset.py	Mon Mar 16 17:11:25 2015 +0900
@@ -2718,6 +2718,8 @@
         """Returns a new object with the intersection of the two collections.
 
         This is part of the mandatory API for smartset."""
+        if isinstance(other, fullreposet):
+            return self
         return self.filter(other.__contains__, cache=False)
 
     def __add__(self, other):