Mercurial > hg
annotate tests/test-pull-pull-corruption.t @ 39569:cc23c09bc562
util: optimize cost auditing on insert
Calling popoldest() on insert with cost auditing enabled introduces
significant overhead.
The primary reason for this overhead is that popoldest() needs to
walk the linked list to find the first non-empty node. When we
call popoldest() within a loop, this can become quadratic. The
performance impact is more pronounced on caches with large capacities.
This commit effectively inlines the popoldest() call into
_enforcecostlimit(). By doing so, we only do the backwards walk
to find the first empty node once. However, we still may still
perform this work on insert when the cache is near cost capacity.
So this is only a partial performance win.
$ hg perflrucachedict --size 4 --gets 1000000 --sets 1000000 --mixed 1000000 --costlimit 100
! gets w/ cost limit
! wall 0.598737 comb 0.590000 user 0.590000 sys 0.000000 (best of 17)
! inserts w/ cost limit
! wall 1.694282 comb 1.700000 user 1.700000 sys 0.000000 (best of 6)
! wall 1.659181 comb 1.650000 user 1.650000 sys 0.000000 (best of 7)
! mixed w/ cost limit
! wall 1.157655 comb 1.150000 user 1.150000 sys 0.000000 (best of 9)
! wall 1.139955 comb 1.140000 user 1.140000 sys 0.000000 (best of 9)
$ hg perflrucachedict --size 1000 --gets 1000000 --sets 1000000 --mixed 1000000 --costlimit 10000
! gets w/ cost limit
! wall 0.598526 comb 0.600000 user 0.600000 sys 0.000000 (best of 17)
! wall 0.601993 comb 0.600000 user 0.600000 sys 0.000000 (best of 17)
! inserts w/ cost limit
! wall 37.838315 comb 37.840000 user 37.840000 sys 0.000000 (best of 3)
! wall 25.105273 comb 25.080000 user 25.080000 sys 0.000000 (best of 3)
! mixed w/ cost limit
! wall 18.060198 comb 18.060000 user 18.060000 sys 0.000000 (best of 3)
! wall 12.104470 comb 12.070000 user 12.070000 sys 0.000000 (best of 3)
$ hg perflrucachedict --size 1000 --gets 1000000 --sets 1000000 --mixed 1000000 --costlimit 10000 --mixedgetfreq 90
! gets w/ cost limit
! wall 0.600024 comb 0.600000 user 0.600000 sys 0.000000 (best of 17)
! wall 0.614439 comb 0.620000 user 0.620000 sys 0.000000 (best of 17)
! inserts w/ cost limit
! wall 37.154547 comb 37.120000 user 37.120000 sys 0.000000 (best of 3)
! wall 25.963028 comb 25.960000 user 25.960000 sys 0.000000 (best of 3)
! mixed w/ cost limit
! wall 4.381602 comb 4.380000 user 4.370000 sys 0.010000 (best of 3)
! wall 3.174256 comb 3.170000 user 3.170000 sys 0.000000 (best of 4)
Differential Revision: https://phab.mercurial-scm.org/D4504
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 06 Sep 2018 12:40:30 -0700 |
parents | f1186c292d03 |
children | 2f2682f40ea0 |
rev | line source |
---|---|
12481
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
1 Corrupt an hg repo with two pulls. |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
2 create one repo with a long history |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
3 |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
4 $ hg init source1 |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
5 $ cd source1 |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
6 $ touch foo |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
7 $ hg add foo |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
8 $ for i in 1 2 3 4 5 6 7 8 9 10; do |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
9 > echo $i >> foo |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
10 > hg ci -m $i |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
11 > done |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
12 $ cd .. |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
13 |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
14 create one repo with a shorter history |
1785
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
15 |
12481
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
16 $ hg clone -r 0 source1 source2 |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
17 adding changesets |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
18 adding manifests |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
19 adding file changes |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
20 added 1 changesets with 1 changes to 1 files |
34661
eb586ed5d8ce
transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
16913
diff
changeset
|
21 new changesets 495a0ec48aaf |
12481
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
22 updating to branch default |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
23 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
24 $ cd source2 |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
25 $ echo a >> foo |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
26 $ hg ci -m a |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
27 $ cd .. |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
28 |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
29 create a third repo to pull both other repos into it |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
30 |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
31 $ hg init corrupted |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
32 $ cd corrupted |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
33 |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
34 use a hook to make the second pull start while the first one is still running |
1785
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
35 |
12481
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
36 $ echo '[hooks]' >> .hg/hgrc |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
37 $ echo 'prechangegroup = sleep 5' >> .hg/hgrc |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
38 |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
39 start a pull... |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
40 |
16481
37e0872b5ced
tests: remove race in test-pull-pull-corruption.t
Mads Kiilerich <mads@kiilerich.com>
parents:
13439
diff
changeset
|
41 $ hg pull ../source1 > pull.out 2>&1 & |
12481
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
42 |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
43 ... and start another pull before the first one has finished |
1785
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
44 |
12481
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
45 $ sleep 1 |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
46 $ hg pull ../source2 2>/dev/null |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
47 pulling from ../source2 |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
48 searching for changes |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
49 adding changesets |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
50 adding manifests |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
51 adding file changes |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
52 added 1 changesets with 1 changes to 1 files (+1 heads) |
34661
eb586ed5d8ce
transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
16913
diff
changeset
|
53 new changesets ca3c05af513e |
12481
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
54 (run 'hg heads' to see heads, 'hg merge' to merge) |
16481
37e0872b5ced
tests: remove race in test-pull-pull-corruption.t
Mads Kiilerich <mads@kiilerich.com>
parents:
13439
diff
changeset
|
55 $ cat pull.out |
37e0872b5ced
tests: remove race in test-pull-pull-corruption.t
Mads Kiilerich <mads@kiilerich.com>
parents:
13439
diff
changeset
|
56 pulling from ../source1 |
37e0872b5ced
tests: remove race in test-pull-pull-corruption.t
Mads Kiilerich <mads@kiilerich.com>
parents:
13439
diff
changeset
|
57 requesting all changes |
37e0872b5ced
tests: remove race in test-pull-pull-corruption.t
Mads Kiilerich <mads@kiilerich.com>
parents:
13439
diff
changeset
|
58 adding changesets |
37e0872b5ced
tests: remove race in test-pull-pull-corruption.t
Mads Kiilerich <mads@kiilerich.com>
parents:
13439
diff
changeset
|
59 adding manifests |
37e0872b5ced
tests: remove race in test-pull-pull-corruption.t
Mads Kiilerich <mads@kiilerich.com>
parents:
13439
diff
changeset
|
60 adding file changes |
37e0872b5ced
tests: remove race in test-pull-pull-corruption.t
Mads Kiilerich <mads@kiilerich.com>
parents:
13439
diff
changeset
|
61 added 10 changesets with 10 changes to 1 files |
34661
eb586ed5d8ce
transaction-summary: show the range of new revisions upon pull/unbundle (BC)
Denis Laxalde <denis.laxalde@logilab.fr>
parents:
16913
diff
changeset
|
62 new changesets 495a0ec48aaf:1e7b6c812ca8 |
16481
37e0872b5ced
tests: remove race in test-pull-pull-corruption.t
Mads Kiilerich <mads@kiilerich.com>
parents:
13439
diff
changeset
|
63 (run 'hg update' to get a working copy) |
1785
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
64 |
12481
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
65 see the result |
1785
81ca1a9bd061
Added test cases for repo corruption fixed in 2e0a288ca93e (issue132)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
66 |
12481
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
67 $ wait |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
68 $ hg verify |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
69 checking changesets |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
70 checking manifests |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
71 crosschecking files in changesets and manifests |
70ef9b470efe
tests: unify test-pull-pull-corruption
Matt Mackall <mpm@selenic.com>
parents:
1785
diff
changeset
|
72 checking files |
39489
f1186c292d03
verify: make output less confusing (issue5924)
Meirambek Omyrzak <meirambek77@gmail.com>
parents:
34661
diff
changeset
|
73 checked 11 changesets with 11 changes to 1 files |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
16481
diff
changeset
|
74 |
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
16481
diff
changeset
|
75 $ cd .. |