t/perf/fsmonitor: perf comparison of multiple fsmonitor integrations

Allows for simple perf comparison of different integrations. I ran it to compare our perl script w/ rs-git-fsmonitor and found 20-30ms of overhead on every command. Output looks like this (extra newlines added for readability) Test this tree --------------------------------------------------------------------------- 7519.4: status (fsmonitor=query-watchman) 0.42(0.37+0.05) 7519.5: status -uno (fsmonitor=query-watchman) 0.19(0.12+0.07) 7519.6: status -uall (fsmonitor=query-watchman) 1.36(0.73+0.62) 7519.7: diff (fsmonitor=query-watchman) 0.14(0.09+0.05) 7519.8: diff -- 0_files (fsmonitor=query-watchman) 0.14(0.11+0.03) 7519.9: diff -- 10_files (fsmonitor=query-watchman) 0.14(0.10+0.04) 7519.10: diff -- 100_files (fsmonitor=query-watchman) 0.14(0.09+0.05) 7519.11: diff -- 1000_files (fsmonitor=query-watchman) 0.14(0.08+0.06) 7519.12: diff -- 10000_files (fsmonitor=query-watchman) 0.14(0.09+0.05) 7519.13: add (fsmonitor=query-watchman) 2.04(1.32+0.66) 7519.16: status (fsmonitor=rs-git-fsmonitor) 0.39(0.32+0.08) 7519.17: status -uno (fsmonitor=rs-git-fsmonitor) 0.17(0.11+0.06) 7519.18: status -uall (fsmonitor=rs-git-fsmonitor) 1.33(0.71+0.61) 7519.19: diff (fsmonitor=rs-git-fsmonitor) 0.11(0.07+0.04) 7519.20: diff -- 0_files (fsmonitor=rs-git-fsmonitor) 0.11(0.09+0.03) 7519.21: diff -- 10_files (fsmonitor=rs-git-fsmonitor) 0.11(0.09+0.03) 7519.22: diff -- 100_files (fsmonitor=rs-git-fsmonitor) 0.11(0.07+0.04) 7519.23: diff -- 1000_files (fsmonitor=rs-git-fsmonitor) 0.11(0.06+0.06) 7519.24: diff -- 10000_files (fsmonitor=rs-git-fsmonitor) 0.11(0.06+0.06) 7519.25: add (fsmonitor=rs-git-fsmonitor) 2.03(1.28+0.69) 7519.28: status (fsmonitor=disabled) 0.77(0.59+0.99) 7519.29: status -uno (fsmonitor=disabled) 0.42(0.33+0.85) 7519.30: status -uall (fsmonitor=disabled) 1.59(1.02+1.34) 7519.31: diff (fsmonitor=disabled) 0.35(0.30+0.81) 7519.32: diff -- 0_files (fsmonitor=disabled) 0.11(0.08+0.04) 7519.33: diff -- 10_files (fsmonitor=disabled) 0.11(0.07+0.04) 7519.34: diff -- 100_files (fsmonitor=disabled) 0.11(0.08+0.03) 7519.35: diff -- 1000_files (fsmonitor=disabled) 0.11(0.10+0.02) 7519.36: diff -- 10000_files (fsmonitor=disabled) 0.12(0.07+0.06) 7519.37: add (fsmonitor=disabled) 2.24(1.48+1.44) Signed-off-by: Nipunn Koorapati <nipunn@dropbox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nipunn Koorapati committed Oct 26, 2020 at 19:32 UTC a948864ae70cef857cc9150a5a89641f52fd32d3
1 file changed +14 -8
t/perf/p7519-fsmonitor.sh
+14 -8
@@ -22,7 +22,9 @@ test_description="Test core.fsmonitor"
22 #
23 # GIT_PERF_7519_UNTRACKED_CACHE: used to configure core.untrackedCache
24 # GIT_PERF_7519_SPLIT_INDEX: used to configure core.splitIndex
25 -# GIT_PERF_7519_FSMONITOR: used to configure core.fsMonitor
25 +# GIT_PERF_7519_FSMONITOR: used to configure core.fsMonitor. May be an
26 +# absolute path to an integration. May be a space delimited list of
27 +# absolute paths to integrations.
28 #
29 # The big win for using fsmonitor is the elimination of the need to scan the
30 # working directory looking for changed and untracked files. If the file
@@ -105,9 +107,9 @@ test_expect_success "one time repo setup" '
107
108 setup_for_fsmonitor() {
109 # set INTEGRATION_SCRIPT depending on the environment
108 - if test -n "$GIT_PERF_7519_FSMONITOR"
110 + if test -n "$INTEGRATION_PATH"
111 then
110 - INTEGRATION_SCRIPT="$GIT_PERF_7519_FSMONITOR"
112 + INTEGRATION_SCRIPT="$INTEGRATION_PATH"
113 else
114 #
115 # Choose integration script based on existence of Watchman.
@@ -192,11 +194,15 @@ test_fsmonitor_suite() {
194 '
195 }
196
195 -test_expect_success "setup for fsmonitor" '
196 - setup_for_fsmonitor
197 -'
198 -
199 -test_fsmonitor_suite
197 +if test -n "$GIT_PERF_7519_FSMONITOR"; then
198 + for INTEGRATION_PATH in $GIT_PERF_7519_FSMONITOR; do
199 + test_expect_success "setup for fsmonitor $INTEGRATION_PATH" 'setup_for_fsmonitor'
200 + test_fsmonitor_suite
201 + done
202 +else
203 + test_expect_success "setup for fsmonitor" 'setup_for_fsmonitor'
204 + test_fsmonitor_suite
205 +fi
206
207 test_expect_success "setup without fsmonitor" '
208 unset INTEGRATION_SCRIPT &&