mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
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)
This commit is contained in:
parent
bc9e0dc64b
commit
499c2ed6e7
@ -2718,6 +2718,8 @@ class abstractsmartset(object):
|
||||
"""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):
|
||||
|
@ -100,8 +100,7 @@ trivial
|
||||
('symbol', '0')
|
||||
('symbol', '1'))
|
||||
* set:
|
||||
<filteredset
|
||||
<spanset+ 0:1>>
|
||||
<spanset+ 0:1>
|
||||
0
|
||||
1
|
||||
$ try 3::6
|
||||
@ -109,8 +108,7 @@ trivial
|
||||
('symbol', '3')
|
||||
('symbol', '6'))
|
||||
* set:
|
||||
<filteredset
|
||||
<baseset [3, 5, 6]>>
|
||||
<baseset [3, 5, 6]>
|
||||
3
|
||||
5
|
||||
6
|
||||
|
Loading…
Reference in New Issue
Block a user