Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t/perf
diff options
context:
space:
mode:
authorNeeraj Singh <neerajsi@microsoft.com>2022-04-05 08:20:18 +0300
committerJunio C Hamano <gitster@pobox.com>2022-04-06 23:13:26 +0300
commit112a9fe60d7c5f02ee1a805d8730d54a458b7ad1 (patch)
tree725380b87324a28694ae21678c418b37ab1c7894 /t/perf
parent5dccd9155f9e2774176beba3a22c14ca5e3fcdb1 (diff)
core.fsyncmethod: performance tests for batch mode
Add basic performance tests for git commands that can add data to the object database. We cover: * git add * git stash * git update-index (via git stash) * git unpack-objects * git commit --all We cover all currently available fsync methods as well. Signed-off-by: Neeraj Singh <neerajsi@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/perf')
-rwxr-xr-xt/perf/p0008-odb-fsync.sh82
1 files changed, 82 insertions, 0 deletions
diff --git a/t/perf/p0008-odb-fsync.sh b/t/perf/p0008-odb-fsync.sh
new file mode 100755
index 0000000000..b3a90f30eb
--- /dev/null
+++ b/t/perf/p0008-odb-fsync.sh
@@ -0,0 +1,82 @@
+#!/bin/sh
+#
+# This test measures the performance of adding new files to the object
+# database. The test was originally added to measure the effect of the
+# core.fsyncMethod=batch mode, which is why we are testing different values of
+# that setting explicitly and creating a lot of unique objects.
+
+test_description="Tests performance of adding things to the object database"
+
+. ./perf-lib.sh
+
+. $TEST_DIRECTORY/lib-unique-files.sh
+
+test_perf_fresh_repo
+test_checkout_worktree
+
+dir_count=10
+files_per_dir=50
+total_files=$((dir_count * files_per_dir))
+
+populate_files () {
+ test_create_unique_files $dir_count $files_per_dir files
+}
+
+setup_repo () {
+ (rm -rf .git || 1) &&
+ git init &&
+ test_commit first &&
+ populate_files
+}
+
+test_perf_fsync_cfgs () {
+ local method &&
+ local cfg &&
+ for method in none fsync batch writeout-only
+ do
+ case $method in
+ none)
+ cfg="-c core.fsync=none"
+ ;;
+ *)
+ cfg="-c core.fsync=loose-object -c core.fsyncMethod=$method"
+ esac &&
+
+ # Set GIT_TEST_FSYNC=1 explicitly since fsync is normally
+ # disabled by t/test-lib.sh.
+ if ! test_perf "$1 (fsyncMethod=$method)" \
+ --setup "$2" \
+ "GIT_TEST_FSYNC=1 git $cfg $3"
+ then
+ break
+ fi
+ done
+}
+
+test_perf_fsync_cfgs "add $total_files files" \
+ "setup_repo" \
+ "add -- files"
+
+test_perf_fsync_cfgs "stash $total_files files" \
+ "setup_repo" \
+ "stash push -u -- files"
+
+test_perf_fsync_cfgs "unpack $total_files files" \
+ "
+ setup_repo &&
+ git -c core.fsync=none add -- files &&
+ git -c core.fsync=none commit -q -m second &&
+ echo HEAD | git pack-objects -q --stdout --revs >test_pack.pack &&
+ setup_repo
+ " \
+ "unpack-objects -q <test_pack.pack"
+
+test_perf_fsync_cfgs "commit $total_files files" \
+ "
+ setup_repo &&
+ git -c core.fsync=none add -- files &&
+ populate_files
+ " \
+ "commit -q -a -m test"
+
+test_done