Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 29934:2c6a05b938d8
revset: fix order of nested 'or' expression (BC)
This fixes the order of 'x & (y + z)' where 'y' and 'z' are not trivial.
The follow-order 'or' operation is slower than the ordered operation if
an input set is large:
#0 #1 #2 #3
0) 0.002968 0.002980 0.002982 0.073042
1) 0.004513 0.004485 0.012029 0.075261
#0: 0:4000 & (0:1099 + 1000:2099 + 2000:3099)
#1: 4000:0 & (0:1099 + 1000:2099 + 2000:3099)
#2: 10000:0 & (0:1099 + 1000:2099 + 2000:3099)
#3: file("path:hg") & (0:1099 + 1000:2099 + 2000:3099)
I've tried another implementation, but which appeared to be slower than
this version.
ss = [getset(repo, fullreposet(repo), x) for x in xs]
return subset.filter(lambda r: any(r in s for s in ss), cache=False)
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 26 Jun 2016 18:17:12 +0900 |
parents | 91a95ad985d8 |
children | e34cd85dc5b1 |
comparison
equal
deleted
inserted
replaced
29933:91a95ad985d8 | 29934:2c6a05b938d8 |
---|---|
405 a = _orsetlist(repo, subset, xs[:p]) | 405 a = _orsetlist(repo, subset, xs[:p]) |
406 b = _orsetlist(repo, subset, xs[p:]) | 406 b = _orsetlist(repo, subset, xs[p:]) |
407 return a + b | 407 return a + b |
408 | 408 |
409 def orset(repo, subset, x, order): | 409 def orset(repo, subset, x, order): |
410 return _orsetlist(repo, subset, getlist(x)) | 410 xs = getlist(x) |
411 if order == followorder: | |
412 # slow path to take the subset order | |
413 return subset & _orsetlist(repo, fullreposet(repo), xs) | |
414 else: | |
415 return _orsetlist(repo, subset, xs) | |
411 | 416 |
412 def notset(repo, subset, x, order): | 417 def notset(repo, subset, x, order): |
413 return subset - getset(repo, subset, x) | 418 return subset - getset(repo, subset, x) |
414 | 419 |
415 def listset(repo, subset, *xs): | 420 def listset(repo, subset, *xs): |