Mercurial > hg
annotate tests/test-check-help.t @ 41979:0d467e4de4ae
discovery: fix embarrassing typo in slice definition
The code introduced in e514799e4e07 ended up having a silly bug. The indexing
selected a single item slice picking only p1. The discovery result was still
correct, but the sampling was hampered, sometime leading to much more round
trips being performed.
Fixing this issue restore the previous sampling behavior.
This fix has a negative performance impact on the pathological case the previous
test has been built.
# parent of this changesets
! wall 5.313884 comb 5.310000 user 5.260000 sys 0.050000 (best of 5)
! wall 6.711860 comb 6.710000 user 6.670000 sys 0.040000 (max of 5)
! wall 5.844016 comb 5.842000 user 5.784000 sys 0.058000 (avg of 5)
! wall 5.778635 comb 5.780000 user 5.740000 sys 0.040000 (median of 5)
# With this changesets.
! wall 6.350879 comb 6.350000 user 6.300000 sys 0.050000 (best of 5)
! wall 6.653647 comb 6.660000 user 6.480000 sys 0.180000 (max of 5)
! wall 6.492762 comb 6.494000 user 6.414000 sys 0.080000 (avg of 5)
! wall 6.547577 comb 6.550000 user 6.490000 sys 0.060000 (median of 5)
Changeset e514799e4e07 raised the question of using the "_uncheckedparentrevs"
instead of the current code. So I ran comparative timing:
# old code: 55919b96c02a (e514799e4e07 parent)
! wall 64.078708 comb 64.080000 user 63.160000 sys 0.920000 (best of 5)
! wall 68.296300 comb 68.290000 user 67.410000 sys 0.880000 (max of 5)
! wall 65.899075 comb 65.894000 user 65.082000 sys 0.812000 (avg of 5)
! wall 66.140286 comb 66.130000 user 65.330000 sys 0.800000 (median of 5)
# buggy code: e514799e4e07
! wall 46.605362 comb 46.610000 user 45.880000 sys 0.730000 (best of 5)
! wall 48.619659 comb 48.620000 user 47.890000 sys 0.730000 (max of 5)
! wall 47.350247 comb 47.350000 user 46.672000 sys 0.678000 (avg of 5)
! wall 46.983224 comb 46.980000 user 46.350000 sys 0.630000 (median of 5)
# fixed code: e514799e4e07 with this fix
! wall 55.858460 comb 55.850000 user 55.090000 sys 0.760000 (best of 5)
! wall 59.048805 comb 59.060000 user 58.110000 sys 0.950000 (max of 5)
! wall 57.192639 comb 57.192000 user 56.350000 sys 0.842000 (avg of 5)
! wall 57.056373 comb 57.060000 user 56.160000 sys 0.900000 (median of 5)
# version using uncheckedparents
! wall 56.471916 comb 56.470000 user 55.630000 sys 0.840000 (best of 5)
! wall 58.228793 comb 58.230000 user 57.600000 sys 0.630000 (max of 5)
! wall 57.377583 comb 57.378000 user 56.674000 sys 0.704000 (avg of 5)
! wall 57.008843 comb 57.010000 user 56.330000 sys 0.680000 (median of 5)
So it looks like the overhead from `_uncheckedparentrevs` is not that impactful.
I'll investigate this shortly. I'm almost done updating our benchmark suite
with more meaningful discovery cases.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 14 Mar 2019 19:13:45 +0000 |
parents | b6c610bf567e |
children | 42d2b31cee0b |
rev | line source |
---|---|
30880
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
1 #require test-repo |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
2 |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
3 $ . "$TESTDIR/helpers-testrepo.sh" |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
4 |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
5 $ cat <<'EOF' > scanhelptopics.py |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
6 > from __future__ import absolute_import, print_function |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
7 > import re |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
8 > import sys |
31498
a248bbfa0bc7
test-check-help: fix to work on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
30880
diff
changeset
|
9 > if sys.platform == "win32": |
40091
c36846abbcd3
tests: import multiple modules separately
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
39707
diff
changeset
|
10 > import msvcrt |
c36846abbcd3
tests: import multiple modules separately
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
39707
diff
changeset
|
11 > import os |
31498
a248bbfa0bc7
test-check-help: fix to work on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
30880
diff
changeset
|
12 > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) |
41000
b6c610bf567e
py3: use bytes stdout in test-check-help.t
Matt Harbison <matt_harbison@yahoo.com>
parents:
40091
diff
changeset
|
13 > stdout = getattr(sys.stdout, 'buffer', sys.stdout) |
30880
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
14 > topics = set() |
35947
a36d3c8a0e41
py3: add b'' prefixes to string literals in test files
Pulkit Goyal <7895pulkit@gmail.com>
parents:
33204
diff
changeset
|
15 > topicre = re.compile(br':hg:`help ([a-z0-9\-.]+)`') |
30880
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
16 > for fname in sys.argv: |
35949
80e5210df25c
py3: make sure we open the file in bytes mode
Pulkit Goyal <7895pulkit@gmail.com>
parents:
35947
diff
changeset
|
17 > with open(fname, 'rb') as f: |
30880
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
18 > topics.update(m.group(1) for m in topicre.finditer(f.read())) |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
19 > for s in sorted(topics): |
41000
b6c610bf567e
py3: use bytes stdout in test-check-help.t
Matt Harbison <matt_harbison@yahoo.com>
parents:
40091
diff
changeset
|
20 > stdout.write(b'%s\n' % s) |
30880
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
21 > EOF |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
22 |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
23 $ cd "$TESTDIR"/.. |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
24 |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
25 Check if ":hg:`help TOPIC`" is valid: |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
26 (use "xargs -n1 -t" to see which help commands are executed) |
b6c051cd1231
help: test if "hg help TOPIC" reference is valid
Yuya Nishihara <yuya@tcha.org>
parents:
diff
changeset
|
27 |
33204
ddd65b4f3ae6
tests: alias syshg and syshgenv so they can be switched conditionally
Yuya Nishihara <yuya@tcha.org>
parents:
33116
diff
changeset
|
28 $ testrepohg files 'glob:{hgdemandimport,hgext,mercurial}/**/*.py' \ |
33116
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
32940
diff
changeset
|
29 > | sed 's|\\|/|g' \ |
39707
5abc47d4ca6b
tests: quote PYTHON usage
Matt Harbison <matt_harbison@yahoo.com>
parents:
39652
diff
changeset
|
30 > | xargs "$PYTHON" "$TESTTMP/scanhelptopics.py" \ |
39652
d2c81e83de2a
phabricator: move extension from contrib to hgext
Augie Fackler <raf@durin42.com>
parents:
35949
diff
changeset
|
31 > | xargs -n1 hg help --config extensions.phabricator= > /dev/null |