|
1 #!/bin/bash |
|
2 |
|
3 # Measure the performance of a list of revsets on a range of revisions defined |
|
4 # by parameter. Checkout one by one and run perfrevset with every revset in the |
|
5 # list to benchmark its performance. |
|
6 # |
|
7 # First argument is the starting revision to measure performance |
|
8 # Second argument the ending revision to measure performance |
|
9 # Third argument is the file from which the revset array will be taken |
|
10 # |
|
11 # You should run this from the root of your mercurial repository. |
|
12 # |
|
13 # This script also does one run of the current version of mercurial installed |
|
14 # to compare performance. |
|
15 |
|
16 HG="hg update" |
|
17 PERF="./hg perfrevset" |
|
18 BASE_PERF="hg perfrevset" |
|
19 |
|
20 START=$1 |
|
21 END=$2 |
|
22 readarray REVSETS < $3 |
|
23 |
|
24 hg update --quiet |
|
25 |
|
26 echo "Starting time benchmarking" |
|
27 echo |
|
28 |
|
29 echo "Revsets to benchmark" |
|
30 echo "----------------------------" |
|
31 |
|
32 for (( j = 0; j < ${#REVSETS[@]}; j++ )); |
|
33 do |
|
34 echo "${j}) ${REVSETS[$j]}" |
|
35 done |
|
36 |
|
37 echo "----------------------------" |
|
38 echo |
|
39 |
|
40 # Benchmark baseline |
|
41 echo "Benchmarking baseline" |
|
42 |
|
43 for (( j = 0; j < ${#REVSETS[@]}; j++ )); |
|
44 do |
|
45 echo -n "${j}) " |
|
46 $BASE_PERF "${REVSETS[$j]}" |
|
47 done |
|
48 |
|
49 echo |
|
50 echo |
|
51 |
|
52 # Benchmark revisions |
|
53 for i in $(seq $START $END); |
|
54 do |
|
55 echo "----------------------------" |
|
56 echo -n "Revision: " |
|
57 hg log -r $i --template "{desc|firstline}" |
|
58 |
|
59 echo "----------------------------" |
|
60 $HG $i |
|
61 for (( j = 0; j < ${#REVSETS[@]}; j++ )); |
|
62 do |
|
63 echo -n "${j}) " |
|
64 $PERF "${REVSETS[$j]}" |
|
65 done |
|
66 echo "----------------------------" |
|
67 done |
|
68 |
|
69 $HG |
|
70 |
|
71 # Benchmark current code |
|
72 echo "Benchmarking current code" |
|
73 |
|
74 for (( j = 0; j < ${#REVSETS[@]}; j++ )); |
|
75 do |
|
76 echo -n "${j}) " |
|
77 $PERF "${REVSETS[$j]}" |
|
78 done |
|
79 |
|
80 |
|
81 echo |
|
82 echo "Time benchmarking finished" |
|
83 |
|
84 |