t/perf: add last-modified perf script

This just runs some simple last-modified commands. We already test correctness in the regular suite, so this is just about finding performance regressions from one version to another. Based-on-patch-by: Jeff King <peff@peff.net> Signed-off-by: Toon Claes <toon@iotcl.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Toon Claes committed Aug 5, 2025 at 11:33 UTC 97d5301c54152d91a4e47449f759567f83140d4f
2 files changed +23
t/meson.build
+1
@@ -1155,6 +1155,7 @@ benchmarks = [
1155 'perf/p7820-grep-engines.sh',
1156 'perf/p7821-grep-engines-fixed.sh',
1157 'perf/p7822-grep-perl-character.sh',
1158 + 'perf/p8020-last-modified.sh',
1159 'perf/p9210-scalar.sh',
1160 'perf/p9300-fast-import-export.sh',
1161 ]
t/perf/p8020-last-modified.sh new
+22
@@ -0,0 +1,22 @@
1 +#!/bin/sh
2 +
3 +test_description='last-modified perf tests'
4 +. ./perf-lib.sh
5 +
6 +test_perf_default_repo
7 +
8 +test_perf 'top-level last-modified' '
9 + git last-modified HEAD
10 +'
11 +
12 +test_perf 'top-level recursive last-modified' '
13 + git last-modified -r HEAD
14 +'
15 +
16 +test_perf 'subdir last-modified' '
17 + git ls-tree -d HEAD >subtrees &&
18 + path="$(head -n 1 subtrees | cut -f2)" &&
19 + git last-modified -r HEAD -- "$path"
20 +'
21 +
22 +test_done