Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 22449:da05fe01170b
revset: make descendants() lazier
Previously descendants() would force the provided subset to become a set. In
the case of revsets like '(%ld::) - (%ld)' (as used by histedit) this would
force the '- (%ld)' set to be evaluated, which produced a set containing every
commit in the repo (except %ld). This takes 0.6s on large repos.
This changes descendants to trust the subset to implement __contains__
efficiently, which improves the above revset to 0.16s. Shaving 0.4 seconds off
of histedit.
revset #27: (20000::) - (20000)
0) obsolete feature not enabled but 54243 markers found!
! wall 0.023640 comb 0.020000 user 0.020000 sys 0.000000 (best of 100)
1) obsolete feature not enabled but 54243 markers found!
! wall 0.019589 comb 0.020000 user 0.020000 sys 0.000000 (best of 100)
This commit removes the final revset related perf hotspot from histedit.
Combined with the previous two patches, they shave a little over 3 seconds off
histedit on large repos.
author | Durham Goode <durham@fb.com> |
---|---|
date | Fri, 12 Sep 2014 16:21:13 -0700 |
parents | 3efe3c2609e0 |
children | 95af98616aa7 |
comparison
equal
deleted
inserted
replaced
22448:8afaf7cef35a | 22449:da05fe01170b |
---|---|
664 s = _revdescendants(repo, args, followfirst) | 664 s = _revdescendants(repo, args, followfirst) |
665 | 665 |
666 # Both sets need to be ascending in order to lazily return the union | 666 # Both sets need to be ascending in order to lazily return the union |
667 # in the correct order. | 667 # in the correct order. |
668 args.ascending() | 668 args.ascending() |
669 | 669 result = (orderedlazyset(s, subset.__contains__, ascending=True) + |
670 subsetset = subset.set() | 670 orderedlazyset(args, subset.__contains__, ascending=True)) |
671 result = (orderedlazyset(s, subsetset.__contains__, ascending=True) + | |
672 orderedlazyset(args, subsetset.__contains__, ascending=True)) | |
673 | 671 |
674 # Wrap result in a lazyset since it's an _addset, which doesn't implement | 672 # Wrap result in a lazyset since it's an _addset, which doesn't implement |
675 # all the necessary functions to be consumed by callers. | 673 # all the necessary functions to be consumed by callers. |
676 return orderedlazyset(result, lambda r: True, ascending=True) | 674 return orderedlazyset(result, lambda r: True, ascending=True) |
677 | 675 |