mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
9c4de6ba91
The canonical way of doing 'roots(X)' is 'X - children(X)'. This is what the implementation used to be. However, computing children is expensive because it is unbounded. Any changesets in the repository may be a children of '0' so you have to look at all changesets in the repository to compute children(0). Moreover the current revsets implementation for children is not lazy, leading to bad performance when fetching the first result. There is a more restricted algorithm to compute roots: roots(X) = [r for r in X if not parents(r) & X] This achieve the same result while only looking for parent/children relation in the X set itself, making the algorithm 'O(len(X))' membership operation. Another advantages is that it turns the check into a simple filter, preserving all laziness property of the underlying revsets. The speed is very significant and some laziness is restored. -) revset without 'roots(...)' to compare to base line 0) before this change 1) after this change revset #0: roots((tip~100::) - (tip~100::tip)) plain min last -) 0.001082 0.000993 0.000790 0) 0.001366 0.001385 0.001339 1) 0.001257 92% 0.001028 74% 0.000821 61% revset #1: roots((0::) - (0::tip)) plain min last -) 0.134551 0.144682 0.068453 0) 0.161822 0.171786 0.157683 1) 0.137583 85% 0.146204 85% 0.070012 44% revset #2: roots(tip~100:) plain min first last -) 0.000219 0.000225 0.000231 0.000229 0) 0.000513 0.000529 0.000507 0.000539 1) 0.000463 90% 0.000269 50% 0.000267 52% 0.000463 85% revset #3: roots(:42) plain min first last -) 0.000119 0.000146 0.000146 0.000146 0) 0.000231 0.000254 0.000253 0.000260 1) 0.000216 93% 0.000186 73% 0.000184 72% 0.000244 93% revset #4: roots(not public()) plain min first -) 0.000478 0.000502 0.000504 0) 0.000611 0.000639 0.000634 1) 0.000604 0.000560 87% 0.000558 revset #5: roots((0:tip)::) plain min max first last -) 0.057795 0.004905 0.058260 0.004908 0.038812 0) 0.132845 0.118931 0.130306 0.114280 0.127742 1) 0.111659 84% 0.005023 4% 0.111658 85% 0.005022 4% 0.092490 72% revset #6: roots(0::tip) plain min max first last -) 0.032971 0.033947 0.033460 0.032350 0.033125 0) 0.083671 0.081953 0.084074 0.080364 0.086069 1) 0.074720 89% 0.035547 43% 0.077025 91% 0.033729 41% 0.083197 revset #7: 42:68 and roots(42:tip) plain min max first last -) 0.006827 0.000251 0.006830 0.000254 0.006771 0) 0.000337 0.000353 0.000366 0.000350 0.000366 1) 0.000318 94% 0.000297 84% 0.000353 0.000293 83% 0.000351 revset #8: roots(0:tip) plain min max first last -) 0.002119 0.000145 0.000147 0.000147 0.000147 0) 0.047441 0.040660 0.045662 0.040284 0.043435 1) 0.038057 80% 0.000187 0% 0.034919 76% 0.000186 0% 0.035097 80% revset #0: roots(:42 + tip~42:) plain min max first last sort -) 0.000321 0.000317 0.000319 0.000308 0.000369 0.000343 0) 0.000772 0.000751 0.000811 0.000750 0.000802 0.000783 1) 0.000632 81% 0.000369 49% 0.000617 76% 0.000358 47% 0.000601 74% 0.000642 81%
138 lines
3.4 KiB
Plaintext
138 lines
3.4 KiB
Plaintext
# All revsets ever used with revsetbenchmarks.py script
|
|
#
|
|
# The goal of this file is to gather all revsets ever used for benchmarking
|
|
# revset's performance. It should be used to gather revsets that test a
|
|
# specific usecase or a specific implementation of revset predicates.
|
|
# If you are working on the smartset implementation itself, check
|
|
# 'base-revsets.txt'.
|
|
#
|
|
# Please update this file with any revsets you use for benchmarking a change so
|
|
# that future contributors can easily find and retest it when doing further
|
|
# modification. Feel free to highlight interresting variants if needed.
|
|
|
|
|
|
## Revset from this section are all extracted from changelog when this file was
|
|
# created. Feel free to dig and improve documentation.
|
|
|
|
# Used in revision da05fe01170b
|
|
(20000::) - (20000)
|
|
# Used in revision 95af98616aa7
|
|
parents(20000)
|
|
# Used in revision 186fd06283b4
|
|
(_intlist('20000\x0020001')) and merge()
|
|
# Used in revision 911f5a6579d1
|
|
p1(20000)
|
|
p2(10000)
|
|
# Used in revision b6dc3b79bb25
|
|
0::
|
|
# Used in revision faf4f63533ff
|
|
bookmark()
|
|
# Used in revision 22ba2c0825da
|
|
tip~25
|
|
# Used in revision 0cf46b8298fe
|
|
bisect(range)
|
|
# Used in revision 5b65429721d5
|
|
divergent()
|
|
# Used in revision 6261b9c549a2
|
|
file(COPYING)
|
|
# Used in revision 44f471102f3a
|
|
follow(COPYING)
|
|
# Used in revision 8040a44aab1c
|
|
origin(tip)
|
|
# Used in revision bbf4f3dfd700
|
|
rev(25)
|
|
# Used in revision a428db9ab61d
|
|
p1()
|
|
# Used in revision c1546d7400ef
|
|
min(0::)
|
|
# Used in revision 546fa6576815
|
|
author(lmoscovicz) or author(mpm)
|
|
author(mpm) or author(lmoscovicz)
|
|
# Used in revision 9bfe68357c01
|
|
public() and id("d82e2223f132")
|
|
# Used in revision ba89f7b542c9
|
|
rev(25)
|
|
# Used in revision eb763217152a
|
|
rev(210000)
|
|
# Used in revision 69524a05a7fa
|
|
10:100
|
|
parents(10):parents(100)
|
|
# Used in revision 6f1b8b3f12fd
|
|
100~5
|
|
parents(100)~5
|
|
(100~5)~5
|
|
# Used in revision 7a42e5d4c418
|
|
children(tip~100)
|
|
# Used in revision 7e8737e6ab08
|
|
100^1
|
|
parents(100)^1
|
|
(100^1)^1
|
|
# Used in revision 30e0dcd7c5ff
|
|
matching(100)
|
|
matching(parents(100))
|
|
# Used in revision aafeaba22826
|
|
0|1|2|3|4|5|6|7|8|9
|
|
# Used in revision 33c7a94d4dd0
|
|
tip:0
|
|
# Used in revision 7d369fae098e
|
|
(0:100000)
|
|
# Used in revision b333ca94403d
|
|
0 + 1 + 2 + ... + 200
|
|
0 + 1 + 2 + ... + 1000
|
|
sort(0 + 1 + 2 + ... + 200)
|
|
sort(0 + 1 + 2 + ... + 1000)
|
|
# Used in revision 7fbef7932af9
|
|
first(0 + 1 + 2 + ... + 1000)
|
|
# Used in revision ceaf04bb14ff
|
|
0:1000
|
|
# Used in revision 262e6ad93885
|
|
not public()
|
|
(tip~1000::) - public()
|
|
not public() and branch("default")
|
|
# Used in revision 15412bba5a68
|
|
0::tip
|
|
|
|
## all the revsets from this section have been taken from the former central file
|
|
# for revset's benchmarking, they are undocumented for this reason.
|
|
all()
|
|
draft()
|
|
::tip
|
|
draft() and ::tip
|
|
::tip and draft()
|
|
author(lmoscovicz)
|
|
author(mpm)
|
|
::p1(p1(tip))::
|
|
public()
|
|
:10000 and public()
|
|
:10000 and draft()
|
|
(not public() - obsolete())
|
|
|
|
# The one below is used by rebase
|
|
(children(ancestor(tip~5, tip)) and ::(tip~5))::
|
|
|
|
# those two `roots(...)` inputs are close to what phase movement use.
|
|
roots((tip~100::) - (tip~100::tip))
|
|
roots((0::) - (0::tip))
|
|
|
|
# more roots testing
|
|
roots(tip~100:)
|
|
roots(:42)
|
|
roots(not public())
|
|
roots((0:tip)::)
|
|
roots(0::tip)
|
|
42:68 and roots(42:tip)
|
|
# Used in revision f140d6207cca
|
|
roots(0:tip)
|
|
# test disjoint set with multiple roots
|
|
roots((:42) + (tip~42:))
|
|
|
|
# Testing the behavior of "head()" in various situations
|
|
head()
|
|
head() - public()
|
|
draft() and head()
|
|
head() and author("mpm")
|
|
|
|
# testing the mutable phases set
|
|
draft()
|
|
secret()
|