Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 23005:9bfe68357c01
revset-node: speedup by a few hundred fold
Instead of checking all elements of the subset against a single rev, just check
if this rev is in the subset. The old way was inherited from when the subset was
a list.
Non surprise, this provide massive speedup.
id("d82e2223f132")
before) wall 0.008205 comb 0.000000 user 0.000000 sys 0.000000 (best of 302)
after) wall 0.000069 comb 0.000000 user 0.000000 sys 0.000000 (best of 34518)
revset #1: public() and id("d82e2223f132")
before) wall 0.019763 comb 0.020000 user 0.020000 sys 0.000000 (best of 124)
after) wall 0.000101 comb 0.000000 user 0.000000 sys 0.000000 (best of 20130)
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Sat, 11 Oct 2014 01:39:20 -0700 |
parents | 30b602b2c340 |
children | 73d9d5548dfe |
comparison
equal
deleted
inserted
replaced
23004:30b602b2c340 | 23005:9bfe68357c01 |
---|---|
1130 rn = None | 1130 rn = None |
1131 pm = repo.changelog._partialmatch(n) | 1131 pm = repo.changelog._partialmatch(n) |
1132 if pm is not None: | 1132 if pm is not None: |
1133 rn = repo.changelog.rev(pm) | 1133 rn = repo.changelog.rev(pm) |
1134 | 1134 |
1135 return subset.filter(lambda r: r == rn) | 1135 if rn is None: |
1136 return baseset() | |
1137 result = baseset([rn]) | |
1138 return result & subset | |
1136 | 1139 |
1137 def obsolete(repo, subset, x): | 1140 def obsolete(repo, subset, x): |
1138 """``obsolete()`` | 1141 """``obsolete()`` |
1139 Mutable changeset with a newer version.""" | 1142 Mutable changeset with a newer version.""" |
1140 # i18n: "obsolete" is a keyword | 1143 # i18n: "obsolete" is a keyword |