changeset 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 bb1bd9ee323d
files mercurial/revset.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Fri Oct 10 17:28:18 2014 -0700
+++ b/mercurial/revset.py	Sat Oct 11 01:39:20 2014 -0700
@@ -1132,7 +1132,10 @@
         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()``