Mercurial > hg-stable
changeset 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 | 73477e755cd2 |
files | mercurial/revset.py tests/test-revset.t |
diffstat | 2 files changed, 4 insertions(+), 4 deletions(-) [+] |
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):
--- a/tests/test-revset.t Mon Mar 16 18:36:53 2015 +0900 +++ b/tests/test-revset.t Mon Mar 16 17:11:25 2015 +0900 @@ -100,8 +100,7 @@ ('symbol', '0') ('symbol', '1')) * set: - <filteredset - <spanset+ 0:1>> + <spanset+ 0:1> 0 1 $ try 3::6 @@ -109,8 +108,7 @@ ('symbol', '3') ('symbol', '6')) * set: - <filteredset - <baseset [3, 5, 6]>> + <baseset [3, 5, 6]> 3 5 6