2bfa953e5d
Test v2.29.0-rc1 this tree ----------------------------------------------------------------------------------------------------------------- 7519.2: status (fsmonitor=.git/hooks/fsmonitor-watchman) 1.48(0.79+0.67) 1.48(0.79+0.67) +0.0% 7519.3: status -uno (fsmonitor=.git/hooks/fsmonitor-watchman) 0.16(0.11+0.05) 0.17(0.13+0.04) +6.3% 7519.4: status -uall (fsmonitor=.git/hooks/fsmonitor-watchman) 1.36(0.77+0.58) 1.37(0.72+0.63) +0.7% 7519.5: diff (fsmonitor=.git/hooks/fsmonitor-watchman) 0.84(0.21+0.63) 0.14(0.11+0.03) -83.3% 7519.6: diff -- 0_files (fsmonitor=.git/hooks/fsmonitor-watchman) 0.12(0.07+0.05) 0.13(0.09+0.04) +8.3% 7519.7: diff -- 10_files (fsmonitor=.git/hooks/fsmonitor-watchman) 0.12(0.09+0.04) 0.13(0.07+0.06) +8.3% 7519.8: diff -- 100_files (fsmonitor=.git/hooks/fsmonitor-watchman) 0.12(0.08+0.05) 0.12(0.08+0.05) +0.0% 7519.9: diff -- 1000_files (fsmonitor=.git/hooks/fsmonitor-watchman) 0.12(0.08+0.05) 0.13(0.09+0.04) +8.3% 7519.10: diff -- 10000_files (fsmonitor=.git/hooks/fsmonitor-watchman) 0.14(0.08+0.06) 0.13(0.07+0.06) -7.1% 7519.11: add (fsmonitor=.git/hooks/fsmonitor-watchman) 2.75(1.41+1.27) 2.03(1.26+0.70) -26.2% 7519.13: status (fsmonitor=) 1.38(1.03+1.04) 1.37(1.04+1.04) -0.7% 7519.14: status -uno (fsmonitor=) 1.11(0.83+0.98) 1.10(0.89+0.90) -0.9% 7519.15: status -uall (fsmonitor=) 2.30(1.57+1.42) 2.31(1.49+1.50) +0.4% 7519.16: diff (fsmonitor=) 1.43(1.13+1.76) 1.46(1.19+1.72) +2.1% 7519.17: diff -- 0_files (fsmonitor=) 0.10(0.08+0.04) 0.11(0.08+0.04) +10.0% 7519.18: diff -- 10_files (fsmonitor=) 0.10(0.07+0.05) 0.11(0.08+0.04) +10.0% 7519.19: diff -- 100_files (fsmonitor=) 0.10(0.07+0.04) 0.11(0.07+0.05) +10.0% 7519.20: diff -- 1000_files (fsmonitor=) 0.10(0.08+0.03) 0.11(0.08+0.04) +10.0% 7519.21: diff -- 10000_files (fsmonitor=) 0.11(0.08+0.05) 0.12(0.07+0.06) +9.1% 7519.22: add (fsmonitor=) 2.26(1.46+1.49) 2.27(1.42+1.55) +0.4% Signed-off-by: Nipunn Koorapati <nipunn@dropbox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
198 lines
5.5 KiB
Bash
Executable File
198 lines
5.5 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description="Test core.fsmonitor"
|
|
|
|
. ./perf-lib.sh
|
|
|
|
#
|
|
# Performance test for the fsmonitor feature which enables git to talk to a
|
|
# file system change monitor and avoid having to scan the working directory
|
|
# for new or modified files.
|
|
#
|
|
# By default, the performance test will utilize the Watchman file system
|
|
# monitor if it is installed. If Watchman is not installed, it will use a
|
|
# dummy integration script that does not report any new or modified files.
|
|
# The dummy script has very little overhead which provides optimistic results.
|
|
#
|
|
# The performance test will also use the untracked cache feature if it is
|
|
# available as fsmonitor uses it to speed up scanning for untracked files.
|
|
#
|
|
# There are 3 environment variables that can be used to alter the default
|
|
# behavior of the performance test:
|
|
#
|
|
# GIT_PERF_7519_UNTRACKED_CACHE: used to configure core.untrackedCache
|
|
# GIT_PERF_7519_SPLIT_INDEX: used to configure core.splitIndex
|
|
# GIT_PERF_7519_FSMONITOR: used to configure core.fsMonitor
|
|
#
|
|
# The big win for using fsmonitor is the elimination of the need to scan the
|
|
# working directory looking for changed and untracked files. If the file
|
|
# information is all cached in RAM, the benefits are reduced.
|
|
#
|
|
# GIT_PERF_7519_DROP_CACHE: if set, the OS caches are dropped between tests
|
|
#
|
|
|
|
test_perf_large_repo
|
|
test_checkout_worktree
|
|
|
|
test_lazy_prereq UNTRACKED_CACHE '
|
|
{ git update-index --test-untracked-cache; ret=$?; } &&
|
|
test $ret -ne 1
|
|
'
|
|
|
|
test_lazy_prereq WATCHMAN '
|
|
command -v watchman
|
|
'
|
|
|
|
if test_have_prereq WATCHMAN
|
|
then
|
|
# Convert unix style paths to escaped Windows style paths for Watchman
|
|
case "$(uname -s)" in
|
|
MSYS_NT*)
|
|
GIT_WORK_TREE="$(cygpath -aw "$PWD" | sed 's,\\,/,g')"
|
|
;;
|
|
*)
|
|
GIT_WORK_TREE="$PWD"
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
if test -n "$GIT_PERF_7519_DROP_CACHE"
|
|
then
|
|
# When using GIT_PERF_7519_DROP_CACHE, GIT_PERF_REPEAT_COUNT must be 1 to
|
|
# generate valid results. Otherwise the caching that happens for the nth
|
|
# run will negate the validity of the comparisons.
|
|
if test "$GIT_PERF_REPEAT_COUNT" -ne 1
|
|
then
|
|
echo "warning: Setting GIT_PERF_REPEAT_COUNT=1" >&2
|
|
GIT_PERF_REPEAT_COUNT=1
|
|
fi
|
|
fi
|
|
|
|
test_expect_success "setup for fsmonitor" '
|
|
# set untrackedCache depending on the environment
|
|
if test -n "$GIT_PERF_7519_UNTRACKED_CACHE"
|
|
then
|
|
git config core.untrackedCache "$GIT_PERF_7519_UNTRACKED_CACHE"
|
|
else
|
|
if test_have_prereq UNTRACKED_CACHE
|
|
then
|
|
git config core.untrackedCache true
|
|
else
|
|
git config core.untrackedCache false
|
|
fi
|
|
fi &&
|
|
|
|
# set core.splitindex depending on the environment
|
|
if test -n "$GIT_PERF_7519_SPLIT_INDEX"
|
|
then
|
|
git config core.splitIndex "$GIT_PERF_7519_SPLIT_INDEX"
|
|
fi &&
|
|
|
|
# set INTEGRATION_SCRIPT depending on the environment
|
|
if test -n "$GIT_PERF_7519_FSMONITOR"
|
|
then
|
|
INTEGRATION_SCRIPT="$GIT_PERF_7519_FSMONITOR"
|
|
else
|
|
#
|
|
# Choose integration script based on existence of Watchman.
|
|
# If Watchman exists, watch the work tree and attempt a query.
|
|
# If everything succeeds, use Watchman integration script,
|
|
# else fall back to an empty integration script.
|
|
#
|
|
mkdir .git/hooks &&
|
|
if test_have_prereq WATCHMAN
|
|
then
|
|
INTEGRATION_SCRIPT=".git/hooks/fsmonitor-watchman" &&
|
|
cp "$TEST_DIRECTORY/../templates/hooks--fsmonitor-watchman.sample" "$INTEGRATION_SCRIPT" &&
|
|
watchman watch "$GIT_WORK_TREE" &&
|
|
watchman watch-list | grep -q -F "$GIT_WORK_TREE"
|
|
else
|
|
INTEGRATION_SCRIPT=".git/hooks/fsmonitor-empty" &&
|
|
write_script "$INTEGRATION_SCRIPT"<<-\EOF
|
|
EOF
|
|
fi
|
|
fi &&
|
|
|
|
git config core.fsmonitor "$INTEGRATION_SCRIPT" &&
|
|
git update-index --fsmonitor &&
|
|
mkdir 1_file 10_files 100_files 1000_files 10000_files &&
|
|
for i in $(test_seq 1 10); do touch 10_files/$i; done &&
|
|
for i in $(test_seq 1 100); do touch 100_files/$i; done &&
|
|
for i in $(test_seq 1 1000); do touch 1000_files/$i; done &&
|
|
for i in $(test_seq 1 10000); do touch 10000_files/$i; done &&
|
|
git add 1_file 10_files 100_files 1000_files 10000_files &&
|
|
git commit -m "Add files" &&
|
|
git status # Warm caches
|
|
'
|
|
|
|
test_perf_w_drop_caches () {
|
|
if test -n "$GIT_PERF_7519_DROP_CACHE"; then
|
|
test-tool drop-caches
|
|
fi
|
|
|
|
test_perf "$@"
|
|
}
|
|
|
|
test_fsmonitor_suite() {
|
|
test_perf_w_drop_caches "status (fsmonitor=$INTEGRATION_SCRIPT)" '
|
|
git status
|
|
'
|
|
|
|
test_perf_w_drop_caches "status -uno (fsmonitor=$INTEGRATION_SCRIPT)" '
|
|
git status -uno
|
|
'
|
|
|
|
test_perf_w_drop_caches "status -uall (fsmonitor=$INTEGRATION_SCRIPT)" '
|
|
git status -uall
|
|
'
|
|
|
|
test_perf_w_drop_caches "diff (fsmonitor=$INTEGRATION_SCRIPT)" '
|
|
git diff
|
|
'
|
|
|
|
test_perf_w_drop_caches "diff -- 0_files (fsmonitor=$INTEGRATION_SCRIPT)" '
|
|
git diff -- 1_file
|
|
'
|
|
|
|
test_perf_w_drop_caches "diff -- 10_files (fsmonitor=$INTEGRATION_SCRIPT)" '
|
|
git diff -- 10_files
|
|
'
|
|
|
|
test_perf_w_drop_caches "diff -- 100_files (fsmonitor=$INTEGRATION_SCRIPT)" '
|
|
git diff -- 100_files
|
|
'
|
|
|
|
test_perf_w_drop_caches "diff -- 1000_files (fsmonitor=$INTEGRATION_SCRIPT)" '
|
|
git diff -- 1000_files
|
|
'
|
|
|
|
test_perf_w_drop_caches "diff -- 10000_files (fsmonitor=$INTEGRATION_SCRIPT)" '
|
|
git diff -- 10000_files
|
|
'
|
|
|
|
test_perf_w_drop_caches "add (fsmonitor=$INTEGRATION_SCRIPT)" '
|
|
git add --all
|
|
'
|
|
}
|
|
|
|
test_fsmonitor_suite
|
|
|
|
test_expect_success "setup without fsmonitor" '
|
|
unset INTEGRATION_SCRIPT &&
|
|
git config --unset core.fsmonitor &&
|
|
git update-index --no-fsmonitor
|
|
'
|
|
|
|
test_fsmonitor_suite
|
|
|
|
if test_have_prereq WATCHMAN
|
|
then
|
|
watchman watch-del "$GIT_WORK_TREE" >/dev/null 2>&1 &&
|
|
|
|
# Work around Watchman bug on Windows where it holds on to handles
|
|
# preventing the removal of the trash directory
|
|
watchman shutdown-server >/dev/null 2>&1
|
|
fi
|
|
|
|
test_done
|