# HG changeset patch # User Pierre-Yves David # Date 2014-10-11 08:39:20 # Node ID 9bfe68357c019cf77e04c05d120320c68e536a55 # Parent 30b602b2c340482ea7d5ddc3ba9d019c3d92588d 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) diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -1132,7 +1132,10 @@ def node_(repo, subset, x): if pm is not None: rn = repo.changelog.rev(pm) - return subset.filter(lambda r: r == rn) + if rn is None: + return baseset() + result = baseset([rn]) + return result & subset def obsolete(repo, subset, x): """``obsolete()``