path: root/t/perf
diff options
authorLessley Dennington <>2021-12-06 15:56:01 (GMT)
committerJunio C Hamano <>2021-12-06 17:55:06 (GMT)
commitadd4c864b60766174ad4f74ba7be17e66d61ef16 (patch)
tree1ebac752f4baef2473965a434a5b2d651684a574 /t/perf
parent51ba65b5c355a835fb0d83ee88dc7276dccb66a4 (diff)
blame: enable and test the sparse index
Enable the sparse index for the 'git blame' command. The index was already not expanded with this command, so the most interesting thing to do is to add tests that verify that 'git blame' behaves correctly when the sparse index is enabled and that its performance improves. More specifically, these cases are: 1. The index is not expanded for 'blame' when given paths in the sparse checkout cone at multiple levels. 2. Performance measurably improves for 'blame' with sparse index when given paths in the sparse checkout cone at multiple levels. The `p2000` tests demonstrate a ~60% execution time reduction when running 'blame' for a file two levels deep and and a ~30% execution time reduction for a file three levels deep. Test before after ---------------------------------------------------------------- 2000.62: git blame f2/f4/a (full-v3) 0.31 0.32 +3.2% 2000.63: git blame f2/f4/a (full-v4) 0.29 0.31 +6.9% 2000.64: git blame f2/f4/a (sparse-v3) 0.55 0.23 -58.2% 2000.65: git blame f2/f4/a (sparse-v4) 0.57 0.23 -59.6% 2000.66: git blame f2/f4/f3/a (full-v3) 0.77 0.85 +10.4% 2000.67: git blame f2/f4/f3/a (full-v4) 0.78 0.81 +3.8% 2000.68: git blame f2/f4/f3/a (sparse-v3) 1.07 0.72 -32.7% 2000.99: git blame f2/f4/f3/a (sparse-v4) 1.05 0.73 -30.5% We do not include paths outside the sparse checkout cone because blame does not support blaming files that are not present in the working directory. This is true in both sparse and full checkouts. Signed-off-by: Lessley Dennington <> Reviewed-by: Elijah Newren <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/perf')
1 files changed, 2 insertions, 0 deletions
diff --git a/t/perf/ b/t/perf/
index 5cf9462..cb777c7 100755
--- a/t/perf/
+++ b/t/perf/
@@ -115,5 +115,7 @@ test_perf_on_all git reset --hard
test_perf_on_all git reset -- does-not-exist
test_perf_on_all git diff
test_perf_on_all git diff --cached
+test_perf_on_all git blame $SPARSE_CONE/a
+test_perf_on_all git blame $SPARSE_CONE/f3/a