3 # This test measures the performance of adding new files to the object
4 # database. The test was originally added to measure the effect of the
5 # core.fsyncMethod=batch mode, which is why we are testing different values of
6 # that setting explicitly and creating a lot of unique objects.
8 test_description
="Tests performance of adding things to the object database"
12 .
$TEST_DIRECTORY/lib-unique-files.sh
15 test_checkout_worktree
19 total_files
=$
((dir_count
* files_per_dir
))
22 test_create_unique_files
$dir_count $files_per_dir files
32 test_perf_fsync_cfgs
() {
35 for method
in none fsync
batch writeout-only
39 cfg
="-c core.fsync=none"
42 cfg
="-c core.fsync=loose-object -c core.fsyncMethod=$method"
45 # Set GIT_TEST_FSYNC=1 explicitly since fsync is normally
46 # disabled by t/test-lib.sh.
47 if ! test_perf
"$1 (fsyncMethod=$method)" \
49 "GIT_TEST_FSYNC=1 git $cfg $3"
56 test_perf_fsync_cfgs
"add $total_files files" \
60 test_perf_fsync_cfgs
"stash $total_files files" \
62 "stash push -u -- files"
64 test_perf_fsync_cfgs
"unpack $total_files files" \
67 git -c core.fsync=none add -- files &&
68 git -c core.fsync=none commit -q -m second &&
69 echo HEAD | git pack-objects -q --stdout --revs >test_pack.pack &&
72 "unpack-objects -q <test_pack.pack"
74 test_perf_fsync_cfgs
"commit $total_files files" \
77 git -c core.fsync=none add -- files &&
80 "commit -q -a -m test"