]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t/perf: add last-modified perf script
authorToon Claes <toon@iotcl.com>
Tue, 5 Aug 2025 09:33:57 +0000 (11:33 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 28 Aug 2025 23:44:58 +0000 (16:44 -0700)
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>
t/meson.build
t/perf/p8020-last-modified.sh [new file with mode: 0755]

index 904455e3ab7fe140d89037cc82d6e39ff185e721..b74125b0479394db14d93c62aa0f6c514a5e5e1c 100644 (file)
@@ -1155,6 +1155,7 @@ benchmarks = [
   'perf/p7820-grep-engines.sh',
   'perf/p7821-grep-engines-fixed.sh',
   'perf/p7822-grep-perl-character.sh',
+  'perf/p8020-last-modified.sh',
   'perf/p9210-scalar.sh',
   'perf/p9300-fast-import-export.sh',
 ]
diff --git a/t/perf/p8020-last-modified.sh b/t/perf/p8020-last-modified.sh
new file mode 100755 (executable)
index 0000000..cb1f98d
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+test_description='last-modified perf tests'
+. ./perf-lib.sh
+
+test_perf_default_repo
+
+test_perf 'top-level last-modified' '
+       git last-modified HEAD
+'
+
+test_perf 'top-level recursive last-modified' '
+       git last-modified -r HEAD
+'
+
+test_perf 'subdir last-modified' '
+       git ls-tree -d HEAD >subtrees &&
+       path="$(head -n 1 subtrees | cut -f2)" &&
+       git last-modified -r HEAD -- "$path"
+'
+
+test_done