Raw
1 #!/bin/sh
2
3 test_description='diff-hunks store performance'
4 . ./perf-lib.sh
5
6 test_perf_default_repo
7
8 # Pick a file to blame pseudo-randomly. The sort key is the blob
9 # hash, so it is stable.
10 test_expect_success 'select a file' '
11 git ls-tree -r HEAD | grep ^100644 |
12 sort -k 3 | head -n 1 | cut -f 2 >filelist
13 '
14
15 file=$(cat filelist)
16 export file
17
18 # Warm the store the way an owner would: a stat walk with writing on.
19 test_perf 'warm the store' '
20 git diff-hunks clear &&
21 GIT_DIFF_HUNKS_WRITE=1 git log --all --stat >/dev/null
22 '
23
24 test_expect_success 'ensure the store is warm for the timed reads' '
25 GIT_DIFF_HUNKS_WRITE=1 git log --all --stat >/dev/null
26 '
27
28 test_perf 'log --stat -1000 (store)' '
29 git log --stat -1000 >/dev/null
30 '
31
32 test_perf 'log --stat -1000 (no store)' '
33 git -c core.diffhunks=false log --stat -1000 >/dev/null
34 '
35
36 test_perf 'blame $file (store)' '
37 git blame "$file" >/dev/null
38 '
39
40 test_perf 'blame $file (no store)' '
41 git -c core.diffhunks=false blame "$file" >/dev/null
42 '
43
44 test_expect_success 'clean up store' '
45 git diff-hunks clear
46 '
47
48 test_done