Skip to content

Commit 7a77728

Browse files
committed
p2000: add performance test for 'git add -p'
The previous two changes contributed performance improvements to 'git apply' and 'git add -p' when using a sparse index. Add a performance test to demonstrate this (and to help validate that performance remains good in the future). In the truncated test output below, we see that the full checkout performance changes within noise expectations, but the sparse index cases improve 33% and then 96%. HEAD~3 HEAD~2 HEAD~1 --------------------------------------------------------- 2000.118: (full-v3) 0.80 0.84 +5.0% 0.84 +5.0% 2000.119: (full-v4) 0.76 0.79 +3.9% 0.80 +5.3% 2000.120: (sparse-v3) 2.09 1.39 -33.5% 0.07 -96.7% 2000.121: (sparse-v4) 2.09 1.39 -33.5% 0.07 -96.7% It is worth noting that if our test was more involved and had multiple hunks to evaluate, then the time spent in 'git apply' would dominate due to multiple index loads and writes. As it stands, we need the sparse index improvement in 'git add -p' itself to confirm this performance improvement. Since the change for 'git add -i' is identical, we avoid a second test case for that similar operation. Signed-off-by: Derrick Stolee <[email protected]>
1 parent 63caae8 commit 7a77728

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

t/perf/p2000-sparse-operations.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,6 @@ test_perf_on_all git diff-tree HEAD
135135
test_perf_on_all git diff-tree HEAD -- $SPARSE_CONE/a
136136
test_perf_on_all "git worktree add ../temp && git worktree remove ../temp"
137137
test_perf_on_all git check-attr -a -- $SPARSE_CONE/a
138+
test_perf_on_all 'echo >>a && test_write_lines y | git add -p'
138139

139140
test_done

0 commit comments

Comments
 (0)