forked from microsoft/git
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core.fsyncmethod: 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. This shows the benefit of batch mode relative to an ordinary stash command. Signed-off-by: Neeraj Singh <[email protected]>
- Loading branch information
1 parent
7e9749a
commit 458f5cd
Showing
2 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/sh | ||
# | ||
# This test measures the performance of adding new files to the object database | ||
# and index. The test was originally added to measure the effect of the | ||
# core.fsyncObjectFiles=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 add" | ||
|
||
. ./perf-lib.sh | ||
|
||
. $TEST_DIRECTORY/lib-unique-files.sh | ||
|
||
test_perf_default_repo | ||
test_checkout_worktree | ||
|
||
dir_count=10 | ||
files_per_dir=50 | ||
total_files=$((dir_count * files_per_dir)) | ||
|
||
# We need to create the files each time we run the perf test, but | ||
# we do not want to measure the cost of creating the files, so run | ||
# the test once. | ||
if test "${GIT_PERF_REPEAT_COUNT-1}" -ne 1 | ||
then | ||
echo "warning: Setting GIT_PERF_REPEAT_COUNT=1" >&2 | ||
GIT_PERF_REPEAT_COUNT=1 | ||
fi | ||
|
||
for m in false true batch | ||
do | ||
test_expect_success "create the files for object_fsyncing=$m" ' | ||
git reset --hard && | ||
# create files across directories | ||
test_create_unique_files $dir_count $files_per_dir files | ||
' | ||
|
||
case $m in | ||
false) | ||
FSYNC_CONFIG='-c core.fsync=default,-loose-object -c core.fsyncmethod=fsync' | ||
;; | ||
true) | ||
FSYNC_CONFIG='-c core.fsync=default,loose-object -c core.fsyncmethod=fsync' | ||
;; | ||
batch) | ||
FSYNC_CONFIG='-c core.fsync=default,loose-object -c core.fsyncmethod=batch' | ||
;; | ||
esac | ||
|
||
test_perf "add $total_files files (object_fsyncing=$m)" " | ||
git $FSYNC_CONFIG add files | ||
" | ||
done | ||
|
||
test_done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/sh | ||
# | ||
# This test measures the performance of adding new files to the object database | ||
# and index. The test was originally added to measure the effect of the | ||
# core.fsyncObjectFiles=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 stash" | ||
|
||
. ./perf-lib.sh | ||
|
||
. $TEST_DIRECTORY/lib-unique-files.sh | ||
|
||
test_perf_default_repo | ||
test_checkout_worktree | ||
|
||
dir_count=10 | ||
files_per_dir=50 | ||
total_files=$((dir_count * files_per_dir)) | ||
|
||
# We need to create the files each time we run the perf test, but | ||
# we do not want to measure the cost of creating the files, so run | ||
# the test once. | ||
if test "${GIT_PERF_REPEAT_COUNT-1}" -ne 1 | ||
then | ||
echo "warning: Setting GIT_PERF_REPEAT_COUNT=1" >&2 | ||
GIT_PERF_REPEAT_COUNT=1 | ||
fi | ||
|
||
for m in false true batch | ||
do | ||
test_expect_success "create the files for object_fsyncing=$m" ' | ||
git reset --hard && | ||
# create files across directories | ||
test_create_unique_files $dir_count $files_per_dir files | ||
' | ||
|
||
case $m in | ||
false) | ||
FSYNC_CONFIG='-c core.fsync=default,-loose-object -c core.fsyncmethod=fsync' | ||
;; | ||
true) | ||
FSYNC_CONFIG='-c core.fsync=default,loose-object -c core.fsyncmethod=fsync' | ||
;; | ||
batch) | ||
FSYNC_CONFIG='-c core.fsync=default,loose-object -c core.fsyncmethod=batch' | ||
;; | ||
esac | ||
|
||
# We only stash files in the 'files' subdirectory since | ||
# the perf test infrastructure creates files in the | ||
# current working directory that need to be preserved | ||
test_perf "stash $total_files files (object_fsyncing=$m)" " | ||
git $FSYNC_CONFIG stash push -u -- files | ||
" | ||
done | ||
|
||
test_done |