Skip to content

Commit 9e8a8f0

Browse files
neerajsi-msftdscho
authored andcommitted
core.fsyncobjectfiles: performance tests for add and stash
Add a basic performance test for "git add" and "git stash" of a lot of new objects with various fsync settings. Signed-off-by: Neeraj Singh <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0383e85 commit 9e8a8f0

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed

t/perf/p3700-add.sh

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/sh
2+
#
3+
# This test measures the performance of adding new files to the object database
4+
# and index. The test was originally added to measure the effect of the
5+
# core.fsyncObjectFiles=batch mode, which is why we are testing different values
6+
# of that setting explicitly and creating a lot of unique objects.
7+
8+
test_description="Tests performance of add"
9+
10+
. ./perf-lib.sh
11+
12+
. $TEST_DIRECTORY/lib-unique-files.sh
13+
14+
test_perf_default_repo
15+
test_checkout_worktree
16+
17+
dir_count=10
18+
files_per_dir=50
19+
total_files=$((dir_count * files_per_dir))
20+
21+
# We need to create the files each time we run the perf test, but
22+
# we do not want to measure the cost of creating the files, so run
23+
# the tet once.
24+
if test "${GIT_PERF_REPEAT_COUNT-1}" -ne 1
25+
then
26+
echo "warning: Setting GIT_PERF_REPEAT_COUNT=1" >&2
27+
GIT_PERF_REPEAT_COUNT=1
28+
fi
29+
30+
for m in false true batch
31+
do
32+
test_expect_success "create the files for core.fsyncObjectFiles=$m" '
33+
git reset --hard &&
34+
# create files across directories
35+
test_create_unique_files $dir_count $files_per_dir files
36+
'
37+
38+
test_perf "add $total_files files (core.fsyncObjectFiles=$m)" "
39+
git -c core.fsyncobjectfiles=$m add files
40+
"
41+
done
42+
43+
test_done

t/perf/p3900-stash.sh

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/sh
2+
#
3+
# This test measures the performance of adding new files to the object database
4+
# and index. The test was originally added to measure the effect of the
5+
# core.fsyncObjectFiles=batch mode, which is why we are testing different values
6+
# of that setting explicitly and creating a lot of unique objects.
7+
8+
test_description="Tests performance of stash"
9+
10+
. ./perf-lib.sh
11+
12+
. $TEST_DIRECTORY/lib-unique-files.sh
13+
14+
test_perf_default_repo
15+
test_checkout_worktree
16+
17+
dir_count=10
18+
files_per_dir=50
19+
total_files=$((dir_count * files_per_dir))
20+
21+
# We need to create the files each time we run the perf test, but
22+
# we do not want to measure the cost of creating the files, so run
23+
# the tet once.
24+
if test "${GIT_PERF_REPEAT_COUNT-1}" -ne 1
25+
then
26+
echo "warning: Setting GIT_PERF_REPEAT_COUNT=1" >&2
27+
GIT_PERF_REPEAT_COUNT=1
28+
fi
29+
30+
for m in false true batch
31+
do
32+
test_expect_success "create the files for core.fsyncObjectFiles=$m" '
33+
git reset --hard &&
34+
# create files across directories
35+
test_create_unique_files $dir_count $files_per_dir files
36+
'
37+
38+
# We only stash files in the 'files' subdirectory since
39+
# the perf test infrastructure creates files in the
40+
# current working directory that need to be preserved
41+
test_perf "stash 500 files (core.fsyncObjectFiles=$m)" "
42+
git -c core.fsyncobjectfiles=$m stash push -u -- files
43+
"
44+
done
45+
46+
test_done

0 commit comments

Comments
 (0)