Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/tree/master/t/perf # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / perf` `4315717` connected: add incremental connectivity check via rev-list Kristofer Karlsson committed 2026-10-23 ``` .. repos/ .gitignore 55 Makefile 412 README 7107 aggregate.perl 8537 bisect_regression 2157 bisect_run_script 1471 config 15 generate-repo-p5413-connectivity-check.perl 1225 lib-bitmap.sh 2668 lib-pack.sh 526 min_time.perl 348 p0000-perf-lib-sanity.sh 1074 p0001-rev-list.sh 943 p0002-read-cache.sh 216 p0003-delta-base-cache.sh 911 p0004-lazy-init-name-hash.sh 1219 p0005-status.sh 1434 p0006-read-tree-checkout.sh 2266 p0007-write-cache.sh 579 p0008-odb-fsync.sh 1815 p0009-diff-pathspec.sh 645 p0071-sort.sh 910 p0090-cache-tree.sh 770 p0100-globbing.sh 892 p1006-cat-file.sh 571 p1400-update-ref.sh 718 p1401-ref-store-tombstones.sh 1397 p1450-fsck.sh 134 p1451-fsck-skip-list.sh 710 p1500-graph-walks.sh 2721 p1501-rev-parse-oneline.sh 1721 p2000-sparse-operations.sh 4324 p3010-ls-files.sh 712 p3400-rebase.sh 2007 p3404-rebase-interactive.sh 735 p3904-stash-patch.sh 962 p4000-diff-algorithms.sh 488 p4001-diff-no-index.sh 404 p4002-diff-color-moved.sh 1622 p4205-log-pretty-formats.sh 280 p4209-pickaxe.sh 1276 p4211-line-log.sh 917 p4220-log-grep-engines.sh 1187 p4221-log-grep-engines-fixed.sh 1028 p5302-pack-index.sh 1229 p5303-many-packs.sh 4005 p5304-prune.sh 715 p5310-pack-bitmaps.sh 973 p5311-pack-bitmaps-fetch.sh 1456 p5312-pack-bitmaps-revs.sh 745 p5313-pack-objects.sh 1403 p5314-name-hash.sh 566 p5315-pack-objects-filter.sh 3079 p5326-multi-pack-bitmaps.sh 1685 p5332-multi-pack-reuse.sh 2063 p5333-pseudo-merge-bitmaps.sh 784 p5413-connectivity-check.sh 2652 p5550-fetch-tags.sh 2221 p5551-fetch-rescan.sh 1415 p5600-partial-clone.sh 848 p5601-clone-reference.sh 682 p6010-merge-base.sh 2569 p6011-rev-list-maximal.sh 703 p6100-describe.sh 978 p6300-for-each-ref.sh 3040 p7000-filter-branch.sh 429 p7102-reset.sh 364 p7300-clean.sh 752 p7519-fsmonitor.sh 7844 p7527-builtin-fsmonitor.sh 5635 p7810-grep.sh 512 p7820-grep-engines.sh 2170 p7821-grep-engines-fixed.sh 2038 p7822-grep-perl-character.sh 807 p8020-last-modified.sh 402 p9210-scalar.sh 839 p9300-fast-import-export.sh 678 perf-lib.sh 10099 run 6767 ``` README ``` Git performance tests ===================== This directory holds performance testing scripts for git tools. The first part of this document describes the various ways in which you can run them. When fixing the tools or adding enhancements, you are strongly encouraged to add tests in this directory to cover what you are trying to fix or enhance. The later part of this short document describes how your test scripts should be organized. Running Tests ------------- The easiest way to run tests is to say "make". This runs all the tests on the current git repository. === Running 2 tests in this tree === [...] Test this tree --------------------------------------------------------- 0001.1: rev-list --all 0.54(0.51+0.02) 0001.2: rev-list --all --objects 6.14(5.99+0.11) 7810.1: grep worktree, cheap regex 0.16(0.16+0.35) 7810.2: grep worktree, expensive regex 7.90(29.75+0.37) 7810.3: grep --cached, cheap regex 3.07(3.02+0.25) 7810.4: grep --cached, expensive regex 9.39(30.57+0.24) Output format is in seconds "Elapsed(User + System)" You can compare multiple repositories and even git revisions with the 'run' script: $ ./run . origin/next /path/to/git-tree p0001-rev-list.sh where . stands for the current git tree. The full invocation is ./run [...] [--] [...] A '.' argument is implied if you do not pass any other revisions/directories. You can also manually test this or another git build tree, and then call the aggregation script to summarize the results: $ ./p0001-rev-list.sh [...] $ ./run /path/to/other/git -- ./p0001-rev-list.sh [...] $ ./aggregate.perl . /path/to/other/git ./p0001-rev-list.sh aggregate.perl has the same invocation as 'run', it just does not run anything beforehand. You can set the following variables (also in your config.mak): GIT_PERF_REPEAT_COUNT Number of times a test should be repeated for best-of-N measurements. Defaults to 3. GIT_PERF_MAKE_OPTS Options to use when automatically building a git tree for performance testing. E.g., -j6 would be useful. Passed directly to make as "make $GIT_PERF_MAKE_OPTS". GIT_PERF_MAKE_COMMAND An arbitrary command that'll be run in place of the make command, if set the GIT_PERF_MAKE_OPTS variable is ignored. Useful in cases where source tree changes might require issuing a different make command to different revisions. This can be (ab)used to monkeypatch or otherwise change the tree about to be built. Note that the build directory can be re-used for subsequent runs so the make command might get executed multiple times on the same tree, but don't count on any of that, that's an implementation detail that might change in the future. GIT_PERF_REPO GIT_PERF_LARGE_REPO Repositories to copy for the performance tests. The normal repo should be at least git.git size. The large repo should probably be about linux.git size for optimal results. Both default to the git.git you are running from. GIT_PERF_EXTRA Boolean to enable additional tests. Most test scripts are written to detect regressions between two versions of Git, and the output will compare timings for individual tests between those versions. Some scripts have additional tests which are not run by default, that show patterns within a single version of Git (e.g., performance of index-pack as the number of threads changes). These can be enabled with GIT_PERF_EXTRA. GIT_PERF_USE_SCALAR Boolean indicating whether to register test repo(s) with Scalar before executing tests. You can also pass the options taken by ordinary git tests; the most useful one is: --root=:: Create "trash" directories used to store all temporary data during testing under , instead of the t/ directory. Using this option with a RAM-based filesystem (such as tmpfs) can massively speed up the test suite. Naming Tests ------------ The performance test files are named as: pNNNN-commandname-details.sh where N is a decimal digit. The same conventions for choosing NNNN as for normal tests apply. Writing Tests ------------- The perf script starts much like a normal test script, except it sources perf-lib.sh: #!/bin/sh # # Copyright (c) 2005 Junio C Hamano # test_description='xxx performance test' . ./perf-lib.sh After that you will want to use some of the following: test_perf_fresh_repo # sets up an empty repository test_perf_default_repo # sets up a "normal" repository test_perf_large_repo # sets up a "large" repository test_perf_default_repo sub # ditto, in a subdir "sub" test_checkout_worktree # if you need the worktree too At least one of the first two is required! You can use test_expect_success as usual. In both test_expect_success and in test_perf, running "git" points to the version that is being perf-tested. The $MODERN_GIT variable points to the git wrapper for the currently checked-out version (i.e., the one that matches the t/perf scripts you are running). This is useful if your setup uses commands that only work with newer versions of git than what you might want to test (but obviously your new commands must still create a state that can be used by the older version of git you are testing). For actual performance tests, use test_perf 'descriptive string' ' command1 && command2 ' test_perf spawns a subshell, for lack of better options. This means that * you _must_ export all variables that you need in the subshell * you _must_ flag all variables that you want to persist from the subshell with 'test_export': test_perf 'descriptive string' ' foo=$(git rev-parse HEAD) && test_export foo ' The so-exported variables are automatically marked for export in the shell executing the perf test. For your convenience, test_export is the same as export in the main shell. This feature relies on a bit of magic using 'set' and 'source'. While we have tried to make sure that it can cope with embedded whitespace and other special characters, it will not work with multi-line data. Rather than tracking the performance by run-time as `test_perf` does, you may also track output size by using `test_size`. The stdout of the function should be a single numeric value, which will be captured and shown in the aggregated output. For example: test_perf 'time foo' ' ./foo >foo.out ' test_size 'output size' wc -c