annotate tests/test-serve.t @ 16120:47ee41fcf42b

largefiles: optimize update speed by only updating changed largefiles Historically, during 'hg update', every largefile in the working copy was hashed (which is a very expensive operation on big files) and any largefiles that did not have a hash that matched their standin were updated. This patch optimizes 'hg update' by keeping track of what standins have changed between the old and new revisions, and only updating the largefiles that have changed. This saves a lot of time by avoiding the unecessary calculation of a list of sha1 hashes for big files. With this patch, the time 'hg update' takes to complete is a function of how many largefiles need to be updated and what their size is. Performance tests on a repository with about 80 largefiles ranging from a few MB to about 97 MB are shown below. The tests show how long it takes to run 'hg update' with no changes actually being updated. Mercurial 2.1 release: $ time hg update 0 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles 0 largefiles updated, 0 removed real 0m10.045s user 0m9.367s sys 0m0.674s With this patch: $ time hg update 0 files updated, 0 files merged, 0 files removed, 0 files unresolved real 0m0.965s user 0m0.845s sys 0m0.115s The same repsoitory, without the largefiles extension enabled: $ time hg update 0 files updated, 0 files merged, 0 files removed, 0 files unresolved real 0m0.799s user 0m0.684s sys 0m0.111s So before the patch, 'hg update' with no changes was approximately 9.25s slower with largefiles enabled. With this patch, it is approximately 0.165s slower.
author Na'Tosha Bard <natosha@unity3d.com>
date Mon, 13 Feb 2012 18:37:07 +0100
parents c5c9ca3719f9
children 1791d7662d32
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15446
c5c9ca3719f9 tests: use 'hghave serve' to guard tests that requires serve daemon management
Mads Kiilerich <mads@kiilerich.com>
parents: 13540
diff changeset
1 $ "$TESTDIR/hghave" serve || exit 80
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
2
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
3 $ hgserve()
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
4 > {
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
5 > hg serve -a localhost -d --pid-file=hg.pid -E errors.log -v $@ \
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
6 > | sed -e "s/:$HGPORT1\\([^0-9]\\)/:HGPORT1\1/g" \
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
7 > -e "s/:$HGPORT2\\([^0-9]\\)/:HGPORT2\1/g" \
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
8 > -e 's/http:\/\/[^/]*\//http:\/\/localhost\//'
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
9 > cat hg.pid >> "$DAEMON_PIDS"
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
10 > echo % errors
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
11 > cat errors.log
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
12 > sleep 1
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
13 > if [ "$KILLQUIETLY" = "Y" ]; then
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
14 > kill `cat hg.pid` 2>/dev/null
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
15 > else
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
16 > kill `cat hg.pid`
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
17 > fi
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
18 > sleep 1
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
19 > }
4504
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
20
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
21 $ hg init test
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
22 $ cd test
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
23 $ echo '[web]' > .hg/hgrc
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
24 $ echo 'accesslog = access.log' >> .hg/hgrc
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
25 $ echo "port = $HGPORT1" >> .hg/hgrc
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
26
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
27 Without -v
6300
874ca958025b test-serve: replace copy/paste with shell function
Patrick Mezard <pmezard@gmail.com>
parents: 6262
diff changeset
28
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
29 $ hg serve -a localhost -p $HGPORT -d --pid-file=hg.pid -E errors.log
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
30 $ cat hg.pid >> "$DAEMON_PIDS"
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
31 $ if [ -f access.log ]; then
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
32 $ echo 'access log created - .hg/hgrc respected'
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
33 access log created - .hg/hgrc respected
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
34 $ fi
4504
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
35
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
36 errors
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
37
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
38 $ cat errors.log
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
39
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
40 With -v
4835
9858477ed74c serve: respect settings from .hg/hgrc
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4506
diff changeset
41
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
42 $ hgserve
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
43 listening at http://localhost/ (bound to 127.0.0.1:HGPORT1)
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
44 % errors
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
45
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
46 With -v and -p HGPORT2
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
47
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
48 $ hgserve -p "$HGPORT2"
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
49 listening at http://localhost/ (bound to 127.0.0.1:HGPORT2)
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
50 % errors
4504
c68e6486f295 Add test reproducing a bug in "hg serve -v"
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
51
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
52 With -v and -p daytime (should fail because low port)
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
53
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
54 $ KILLQUIETLY=Y
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
55 $ hgserve -p daytime
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
56 abort: cannot start server at 'localhost:13': Permission denied
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
57 abort: child process failed to start
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
58 % errors
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
59 $ KILLQUIETLY=N
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
60
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
61 With --prefix foo
10633
3318431f2ab4 test-serve: Show if port config and option are correctly used
Thomas Arendsen Hein <thomas@intevation.de>
parents: 6461
diff changeset
62
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
63 $ hgserve --prefix foo
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
64 listening at http://localhost/foo/ (bound to 127.0.0.1:HGPORT1)
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
65 % errors
12076
49463314c24f mail/hgweb: support service names for ports (issue2350)
Brodie Rao <brodie@bitheap.org>
parents: 10633
diff changeset
66
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
67 With --prefix /foo
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
68
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
69 $ hgserve --prefix /foo
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
70 listening at http://localhost/foo/ (bound to 127.0.0.1:HGPORT1)
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
71 % errors
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
72
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
73 With --prefix foo/
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
74
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
75 $ hgserve --prefix foo/
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
76 listening at http://localhost/foo/ (bound to 127.0.0.1:HGPORT1)
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
77 % errors
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
78
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
79 With --prefix /foo/
5971
6d5ecf824a65 tests for hg serve prefix option
Michele Cella <michele.cella@gmail.com>
parents: 5384
diff changeset
80
13540
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
81 $ hgserve --prefix /foo/
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
82 listening at http://localhost/foo/ (bound to 127.0.0.1:HGPORT1)
3ecadce9173d tests: convert test-serve to new format
Patrick Mezard <pmezard@gmail.com>
parents: 12578
diff changeset
83 % errors