diff mercurial/revset.py @ 41222:8aca89a694d4

revset: introduce an API that avoids `formatspec` input serialization Instead of having the data fully serialized, the input can be directly inserted in the tree at a later stage. Just using it for simple "%ld" case provide a significant boost. For example here are the impact on a sample discovery run between two pypy repositories with arbitrary differences (using hg perfdiscovery). $ hg perfdiscovery before: ! wall 0.700435 comb 0.710000 user 0.700000 sys 0.010000 (median of 15) after: ! wall 0.501305 comb 0.510000 user 0.490000 sys 0.020000 (median of 20)
author Boris Feld <boris.feld@octobus.net>
date Fri, 04 Jan 2019 13:41:21 +0100
parents e54bfde922f2
children 4c6fdc7e2e7d
line wrap: on
line diff
--- a/mercurial/revset.py	Fri Jan 04 05:26:13 2019 +0100
+++ b/mercurial/revset.py	Fri Jan 04 13:41:21 2019 +0100
@@ -125,6 +125,13 @@
         return baseset([x])
     return baseset()
 
+def rawsmartset(repo, subset, x, order):
+    """argument is already a smartset, use that directly"""
+    if order == followorder:
+        return subset & x
+    else:
+        return x & subset
+
 def rangeset(repo, subset, x, y, order):
     m = getset(repo, fullreposet(repo), x)
     n = getset(repo, fullreposet(repo), y)
@@ -2216,6 +2223,7 @@
     "ancestor": ancestorspec,
     "parent": parentspec,
     "parentpost": parentpost,
+    "smartset": rawsmartset,
 }
 
 subscriptrelations = {