mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 23:38:50 +03:00
revset: improve head revset performance
Previously the head() revset would iterate over every item in the subset and check if it was a head. Since the subset is often the entire repo, this was slow on large repos. Now we iterate over each item in the head list and check if it's in the subset, which results in much less work. hg log -r 'head()' on a large repo: Before: 0.95s After: 0.28s
This commit is contained in:
parent
36702af6f9
commit
f906635299
@ -940,7 +940,7 @@ def head(repo, subset, x):
|
||||
hs = set()
|
||||
for b, ls in repo.branchmap().iteritems():
|
||||
hs.update(repo[h].rev() for h in ls)
|
||||
return subset.filter(lambda r: r in hs)
|
||||
return baseset(hs).filter(subset.__contains__)
|
||||
|
||||
def heads(repo, subset, x):
|
||||
"""``heads(set)``
|
||||
|
Loading…
Reference in New Issue
Block a user