Mercurial > hg
annotate tests/test-extension-timing.t @ 42743:8c9a6adec67a
rust-discovery: using the children cache in add_missing
The DAG range computation often needs to get back to very old
revisions, and turns out to be disproportionately long, given
that the end goal is to remove the descendents of the given
missing revisons from the undecided set.
The fast iteration capabilities available in the Rust case make
it possible to avoid the DAG range entirely, at the cost of
precomputing the children cache, and to simply iterate on
children of the given missing revisions.
This is a case where staying on the same side of the interface
between the two languages has clear benefits.
On discoveries with initial undecided sets
small enough to bypass sampling entirely, the total cost of
computing the children cache and the subsequent iteration
becomes better than the Python + C counterpart, which relies on
reachableroots2.
For example, on a repo with more than one million revisions with
an initial undecided set of 11 elements, we get these figures:
Rust version with simple iteration
addcommons: 57.287us
first undecided computation: 184.278334ms
first children cache computation: 131.056us
addmissings iteration: 42.766us
first addinfo total: 185.24 ms
Python + C version
first addcommons: 0.29 ms
addcommons 0.21 ms
first undecided computation 191.35 ms
addmissings 45.75 ms
first addinfo total: 237.77 ms
On discoveries with large undecided sets, the initial price paid
makes the first addinfo slower than the Python + C version,
but that's more than compensated by the gain in sampling and
subsequent iterations.
Here's an extreme example with an undecided set of a million revisions:
Rust version:
first undecided computation: 293.842629ms
first children cache computation: 407.911297ms
addmissings iteration: 34.312869ms
first addinfo total: 776.02 ms
taking initial sample
query 2: sampling time: 1318.38 ms
query 2; still undecided: 1005013, sample size is: 200
addmissings: 143.062us
Python + C version:
first undecided computation 298.13 ms
addmissings 80.13 ms
first addinfo total: 399.62 ms
taking initial sample
query 2: sampling time: 3957.23 ms
query 2; still undecided: 1005013, sample size is: 200
addmissings 52.88 ms
Differential Revision: https://phab.mercurial-scm.org/D6428
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Tue, 16 Apr 2019 01:16:39 +0200 |
parents | 6f2510b581a0 |
children | 8cab8db59b6c |
rev | line source |
---|---|
12191
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
1 Test basic extension support |
4064
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
2 |
12191
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
3 $ cat > foobar.py <<EOF |
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
4 > import os |
32337
46ba2cdda476
registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents:
31187
diff
changeset
|
5 > from mercurial import commands, registrar |
21254
51e5c793a9f4
tests: declare commands using decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
20003
diff
changeset
|
6 > cmdtable = {} |
32337
46ba2cdda476
registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents:
31187
diff
changeset
|
7 > command = registrar.command(cmdtable) |
33132
c467d13334ee
configitems: add an official API for extensions to register config item
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
33099
diff
changeset
|
8 > configtable = {} |
c467d13334ee
configitems: add an official API for extensions to register config item
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
33099
diff
changeset
|
9 > configitem = registrar.configitem(configtable) |
36458
2218f5bfafca
py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
36269
diff
changeset
|
10 > configitem(b'tests', b'foo', default=b"Foo") |
12191
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
11 > def uisetup(ui): |
38534
b86664c81833
debug: process --debug flag earlier
Boris Feld <boris.feld@octobus.net>
parents:
38162
diff
changeset
|
12 > ui.debug(b"uisetup called [debug]\\n") |
36458
2218f5bfafca
py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
36269
diff
changeset
|
13 > ui.write(b"uisetup called\\n") |
38534
b86664c81833
debug: process --debug flag earlier
Boris Feld <boris.feld@octobus.net>
parents:
38162
diff
changeset
|
14 > ui.status(b"uisetup called [status]\\n") |
28612
6fb1d3c936d2
tests: explicitly flush output streams
Jun Wu <quark@fb.com>
parents:
27990
diff
changeset
|
15 > ui.flush() |
12191
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
16 > def reposetup(ui, repo): |
36458
2218f5bfafca
py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
36269
diff
changeset
|
17 > ui.write(b"reposetup called for %s\\n" % os.path.basename(repo.root)) |
2218f5bfafca
py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
36269
diff
changeset
|
18 > ui.write(b"ui %s= repo.ui\\n" % (ui == repo.ui and b"=" or b"!")) |
28612
6fb1d3c936d2
tests: explicitly flush output streams
Jun Wu <quark@fb.com>
parents:
27990
diff
changeset
|
19 > ui.flush() |
36458
2218f5bfafca
py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
36269
diff
changeset
|
20 > @command(b'foo', [], b'hg foo') |
12191
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
21 > def foo(ui, *args, **kwargs): |
36458
2218f5bfafca
py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
36269
diff
changeset
|
22 > foo = ui.config(b'tests', b'foo') |
33132
c467d13334ee
configitems: add an official API for extensions to register config item
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
33099
diff
changeset
|
23 > ui.write(foo) |
36458
2218f5bfafca
py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
36269
diff
changeset
|
24 > ui.write(b"\\n") |
2218f5bfafca
py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
36269
diff
changeset
|
25 > @command(b'bar', [], b'hg bar', norepo=True) |
12191
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
26 > def bar(ui, *args, **kwargs): |
36458
2218f5bfafca
py3: add b'' prefixes in tests/test-extension.t
Pulkit Goyal <7895pulkit@gmail.com>
parents:
36269
diff
changeset
|
27 > ui.write(b"Bar\\n") |
12191
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
28 > EOF |
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
29 $ abspath=`pwd`/foobar.py |
4064
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
30 |
12191
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
31 $ mkdir barfoo |
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
32 $ cp foobar.py barfoo/__init__.py |
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
33 $ barfoopath=`pwd`/barfoo |
4064
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
34 |
12191
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
35 $ hg init a |
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
36 $ cd a |
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
37 $ echo foo > file |
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
38 $ hg add file |
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
39 $ hg commit -m 'add file' |
4064
5d9ede002453
install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff
changeset
|
40 |
12191
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
41 $ echo '[extensions]' >> $HGRCPATH |
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
42 $ echo "foobar = $abspath" >> $HGRCPATH |
39507
a5d6bf6032fb
extensions: add timing for extensions reposetup
Boris Feld <boris.feld@octobus.net>
parents:
39221
diff
changeset
|
43 |
40996
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
44 $ filterlog () { |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
45 > sed -e 's!^[0-9/]* [0-9:]* ([0-9]*)>!YYYY/MM/DD HH:MM:SS (PID)>!' |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
46 > } |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
47 |
39507
a5d6bf6032fb
extensions: add timing for extensions reposetup
Boris Feld <boris.feld@octobus.net>
parents:
39221
diff
changeset
|
48 Test extension setup timings |
a5d6bf6032fb
extensions: add timing for extensions reposetup
Boris Feld <boris.feld@octobus.net>
parents:
39221
diff
changeset
|
49 |
40996
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
50 $ hg foo --traceback --config devel.debug.extensions=yes --debug 2>&1 | filterlog |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
51 YYYY/MM/DD HH:MM:SS (PID)> loading extensions |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
52 YYYY/MM/DD HH:MM:SS (PID)> - processing 1 entries |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
53 YYYY/MM/DD HH:MM:SS (PID)> - loading extension: foobar |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
54 YYYY/MM/DD HH:MM:SS (PID)> > foobar extension loaded in * (glob) |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
55 YYYY/MM/DD HH:MM:SS (PID)> - validating extension tables: foobar |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
56 YYYY/MM/DD HH:MM:SS (PID)> - invoking registered callbacks: foobar |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
57 YYYY/MM/DD HH:MM:SS (PID)> > callbacks completed in * (glob) |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
58 YYYY/MM/DD HH:MM:SS (PID)> > loaded 1 extensions, total time * (glob) |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
59 YYYY/MM/DD HH:MM:SS (PID)> - loading configtable attributes |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
60 YYYY/MM/DD HH:MM:SS (PID)> - executing uisetup hooks |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
61 YYYY/MM/DD HH:MM:SS (PID)> - running uisetup for foobar |
39507
a5d6bf6032fb
extensions: add timing for extensions reposetup
Boris Feld <boris.feld@octobus.net>
parents:
39221
diff
changeset
|
62 uisetup called [debug] |
12191
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
63 uisetup called |
38534
b86664c81833
debug: process --debug flag earlier
Boris Feld <boris.feld@octobus.net>
parents:
38162
diff
changeset
|
64 uisetup called [status] |
40996
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
65 YYYY/MM/DD HH:MM:SS (PID)> > uisetup for foobar took * (glob) |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
66 YYYY/MM/DD HH:MM:SS (PID)> > all uisetup took * (glob) |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
67 YYYY/MM/DD HH:MM:SS (PID)> - executing extsetup hooks |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
68 YYYY/MM/DD HH:MM:SS (PID)> - running extsetup for foobar |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
69 YYYY/MM/DD HH:MM:SS (PID)> > extsetup for foobar took * (glob) |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
70 YYYY/MM/DD HH:MM:SS (PID)> > all extsetup took * (glob) |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
71 YYYY/MM/DD HH:MM:SS (PID)> - executing remaining aftercallbacks |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
72 YYYY/MM/DD HH:MM:SS (PID)> > remaining aftercallbacks completed in * (glob) |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
73 YYYY/MM/DD HH:MM:SS (PID)> - loading extension registration objects |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
74 YYYY/MM/DD HH:MM:SS (PID)> > extension registration object loading took * (glob) |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
75 YYYY/MM/DD HH:MM:SS (PID)> > extension foobar take a total of * to load (glob) |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
76 YYYY/MM/DD HH:MM:SS (PID)> extension loading complete |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
77 YYYY/MM/DD HH:MM:SS (PID)> loading additional extensions |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
78 YYYY/MM/DD HH:MM:SS (PID)> - processing 1 entries |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
79 YYYY/MM/DD HH:MM:SS (PID)> > loaded 0 extensions, total time * (glob) |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
80 YYYY/MM/DD HH:MM:SS (PID)> - loading configtable attributes |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
81 YYYY/MM/DD HH:MM:SS (PID)> - executing uisetup hooks |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
82 YYYY/MM/DD HH:MM:SS (PID)> > all uisetup took * (glob) |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
83 YYYY/MM/DD HH:MM:SS (PID)> - executing extsetup hooks |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
84 YYYY/MM/DD HH:MM:SS (PID)> > all extsetup took * (glob) |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
85 YYYY/MM/DD HH:MM:SS (PID)> - executing remaining aftercallbacks |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
86 YYYY/MM/DD HH:MM:SS (PID)> > remaining aftercallbacks completed in * (glob) |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
87 YYYY/MM/DD HH:MM:SS (PID)> - loading extension registration objects |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
88 YYYY/MM/DD HH:MM:SS (PID)> > extension registration object loading took * (glob) |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
89 YYYY/MM/DD HH:MM:SS (PID)> extension loading complete |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
90 YYYY/MM/DD HH:MM:SS (PID)> - executing reposetup hooks |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
91 YYYY/MM/DD HH:MM:SS (PID)> - running reposetup for foobar |
12191
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
92 reposetup called for a |
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
93 ui == repo.ui |
40996
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
94 YYYY/MM/DD HH:MM:SS (PID)> > reposetup for foobar took * (glob) |
6f2510b581a0
extensions: use ui.log() interface to provide detailed loading information
Yuya Nishihara <yuya@tcha.org>
parents:
40440
diff
changeset
|
95 YYYY/MM/DD HH:MM:SS (PID)> > all reposetup took * (glob) |
12191
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
96 Foo |
33939
9d5d040160e6
tests: move baduisetup test inside "#if demandimport"
Martin von Zweigbergk <martinvonz@google.com>
parents:
33736
diff
changeset
|
97 |
12191
56c74b2df53d
tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents:
11070
diff
changeset
|
98 $ cd .. |
9661
c4f6c02e33c4
hgweb: added test case for extension loading phases (issue1824)
Yuya Nishihara <yuya@tcha.org>
parents:
9410
diff
changeset
|
99 |
39507
a5d6bf6032fb
extensions: add timing for extensions reposetup
Boris Feld <boris.feld@octobus.net>
parents:
39221
diff
changeset
|
100 $ echo 'foobar = !' >> $HGRCPATH |