[PATCH 7 of 7] revsetbenchmark: add more example for roots usages

Boris Feld boris.feld at octobus.net
Tue Jan 15 14:33:26 EST 2019


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1547486362 -3600
#      Mon Jan 14 18:19:22 2019 +0100
# Node ID 01b9cd2cb7c6e41567fec956905b623d097a1af1
# Parent  8b13377cb4cb8789429693653091772029d54b15
# EXP-Topic revset.predicates
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 01b9cd2cb7c6
revsetbenchmark: add more example for roots usages

We test the `roots` revset in setting similar to our test for `heads`.

Note that the algorithm used for roots can give result without consuming the
full input set. This provides a significant speedup when testing or accessing
a single value. We can't just replace it with simple, full algorithm like we
did for `heads`. See performance number below:

0) roots((tip~100::) - (tip~100::tip))
1) roots((0::) - (0::tip))
2) roots(tip~100:)
3) roots(:42)
4) roots(not public())
5) roots((0:tip)::)
6) roots(0::tip)
7) 42:68 and roots(42:tip)
8) roots(0:tip)
9) roots((:42) + (tip~42:))
10) roots(all())
11) roots(-10000:-1)
12) (-5000:-1000) and roots(-10000:-1)
13) roots(matching(tip, "author"))
14) roots(matching(tip, "author")) and -10000:-1
15) (-10000:-1) and roots(matching(tip, "author"))

    plain    min      max      first    last     reverse  rev..rst rev..ast sort     sor..rst sor..ast
00) 0.000789 0.000801 0.000801 0.000819 0.000784 0.000774 0.000793 0.000816 0.000815 0.000831 0.000799
01) 0.097610 0.002717 0.096706 0.002615 0.059189 0.089033 0.059862 0.002644 0.098058 0.002640 0.058992
02) 0.000709 0.000117 0.000382 0.000136 0.000384 0.000724 0.000412 0.000133 0.000733 0.000159 0.000416
03) 0.000075 0.000064 0.000093 0.000080 0.000097 0.000089 0.000123 0.000079 0.000105 0.000102 0.000126
04) 0.000055 0.000071 0.000070 0.000087 0.000075 0.000066 0.000100 0.000085 0.000082 0.000110 0.000102
05) 0.088043 0.001084 0.087816 0.001097 0.048049 0.072454 0.047673 0.001089 0.088491 0.001163 0.047824
06) 0.058761 0.001727 0.059324 0.001850 0.058562 0.059198 0.058998 0.001743 0.058556 0.001874 0.059420
07) 0.000131 0.000121 0.000145 0.000138 0.000150 0.000142 0.000178 0.000135 0.000160 0.000163 0.000179
08) 0.058003 0.000077 0.032327 0.000093 0.031966 0.056812 0.031753 0.000092 0.057113 0.000116 0.031933
09) 0.000503 0.000145 0.000469 0.000161 0.000476 0.000564 0.000502 0.000160 0.000537 0.000187 0.000500
10) 0.056654 0.000058 0.033104 0.000073 0.032157 0.056598 0.031877 0.000071 0.056433 0.000094 0.031819
11) 0.005842 0.000081 0.001907 0.000101 0.001883 0.005868 0.001915 0.000099 0.005836 0.000122 0.001896
12) 0.003237 0.000634 0.001784 0.000655 0.001803 0.003245 0.001837 0.000649 0.003231 0.000680 0.001858

diff --git a/contrib/all-revsets.txt b/contrib/all-revsets.txt
--- a/contrib/all-revsets.txt
+++ b/contrib/all-revsets.txt
@@ -147,3 +147,10 @@ heads(-10000:-1)
 heads(matching(tip, "author"))
 heads(matching(tip, "author")) and -10000:-1
 (-10000:-1) and heads(matching(tip, "author"))
+# more roots testing
+roots(all())
+roots(-10000:-1)
+(-5000:-1000) and roots(-10000:-1)
+roots(matching(tip, "author"))
+roots(matching(tip, "author")) and -10000:-1
+(-10000:-1) and roots(matching(tip, "author"))


More information about the Mercurial-devel mailing list