revset-_ancestor: use & instead of filter
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 30 Sep 2014 15:03:54 -0500
changeset 23003 62d19ce9d7b6
parent 23002 2920a96f5839
child 23004 30b602b2c340
revset-_ancestor: use & instead of filter The & operation is more likely optimised. ::10 before) wall 0.028189 comb 0.030000 user 0.030000 sys 0.000000 (best of 100) after) wall 0.001050 comb 0.000000 user 0.000000 sys 0.000000 (best of 2326) ::tip before) wall 0.081132 comb 0.080000 user 0.080000 sys 0.000000 (best of 100) after) wall 0.055418 comb 0.050000 user 0.050000 sys 0.000000 (best of 100)
mercurial/revset.py
--- a/mercurial/revset.py	Thu Oct 16 14:46:37 2014 -0700
+++ b/mercurial/revset.py	Tue Sep 30 15:03:54 2014 -0500
@@ -347,7 +347,7 @@
     if not heads:
         return baseset()
     s = _revancestors(repo, heads, followfirst)
-    return subset.filter(s.__contains__)
+    return subset & s
 
 def ancestors(repo, subset, x):
     """``ancestors(set)``