<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/t/perf/run, branch jch</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=jch</id>
<link rel='self' href='https://git.shady.money/git/atom?h=jch'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2026-01-06T23:56:36Z</updated>
<entry>
<title>t/perf/run: preserve GIT_PERF_* from environment</title>
<updated>2026-01-06T23:56:36Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2026-01-06T10:16:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=79d301c7676e79a09e7a1c65ca754132e1770828'/>
<id>urn:sha1:79d301c7676e79a09e7a1c65ca754132e1770828</id>
<content type='text'>
If you run:

  GIT_PERF_LARGE_REPO=/some/path ./p1006-cat-file.sh

it will use the repo in /some/path. But if you use the "run" helper
script to aggregate and compare results, like this:

  GIT_PERF_LARGE_REPO=/some/path ./run HEAD^ HEAD p1006-cat-file.sh

it will ignore that variable. This is because the presence of the
LARGE_REPO variable in GIT-BUILD-OPTIONS overrides what's in the
environment. This started with 4638e8806e (Makefile: use common template
for GIT-BUILD-OPTIONS, 2024-12-06), which now writes even empty
variables (though arguably it was wrong even before with a non-empty
value, as we generally prefer the environment to take precedence over
on-disk config).

We had the same problem in perf-lib.sh itself, and we hacked around it
with 32b74b9809 (perf: do allow `GIT_PERF_*` to be overridden again,
2025-04-04). That's what lets the direct invocation of "./p1006" work
above.

And in fact that was sufficient for "./run", too, until it started
loading GIT-BUILD-OPTIONS itself in 5756ccd181 (t/perf: fix benchmarks
with out-of-tree builds, 2025-04-28). Now it has the same problem: it
clobbers any incoming GIT_PERF options from the environment.

We can use the same hack here in the "run" script. It's quite ugly, but
it's just short enough that I don't think it's worth trying to factor it
out into a common shell library.

In the long run, we might consider teaching GIT-BUILD-OPTIONS to be more
gentle in overwriting existing entries. There are probably other
GIT_TEST_* variables which would need the same treatment. And if and
when we come up with a more complete solution, we can use it in both
spots.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t/perf: use configured PERL_PATH</title>
<updated>2025-04-28T20:13:51Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-04-28T07:30:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d84b990883284920234f5bc951ea285161fc7bca'/>
<id>urn:sha1:d84b990883284920234f5bc951ea285161fc7bca</id>
<content type='text'>
Our benchmarks use a couple of Perl scripts to compute results. These
Perl scripts get executed directly, and as the shebang is hardcoded to
"/usr/bin/perl" this will fail on any system where the Perl interpreter
is located in a different path.

Our build infrastructure already lets users configure the location of
Perl, which ultimately gets written into the GIT-BUILD-OPTIONS file.
This file is being sourced by "test-lib.sh", and consequently we already
have the "PERL_PATH" variable available that contains its configured
location.

Use "PERL_PATH" to execute Perl scripts, which makes them work on more
esoteric systems like NixOS. Furthermore, adapt the shebang to use
env(1) to execute Perl so that users who have Perl in PATH, but in a
non-standard location can execute the script directly.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>global: convert trivial usages of `test &lt;expr&gt; -a/-o &lt;expr&gt;`</title>
<updated>2023-11-11T00:21:00Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2023-11-10T10:01:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=13420028e5b119d27277d521f4d267212c5ca21c'/>
<id>urn:sha1:13420028e5b119d27277d521f4d267212c5ca21c</id>
<content type='text'>
Our coding guidelines say to not use `test` with `-a` and `-o` because
it can easily lead to bugs. Convert trivial cases where we still use
these to instead instead concatenate multiple invocations of `test` via
`&amp;&amp;` and `||`, respectively.

While not all of the converted instances can cause ambiguity, it is
worth getting rid of all of them regardless:

    - It becomes easier to reason about the code as we do not have to
      argue why one use of `-a`/`-o` is okay while another one isn't.

    - We don't encourage people to use these expressions.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t: convert egrep usage to "grep -E"</title>
<updated>2022-09-21T18:00:18Z</updated>
<author>
<name>Đoàn Trần Công Danh</name>
<email>congdanhqx@gmail.com</email>
</author>
<published>2022-09-21T13:02:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=81580fa06d85ef519a46b0b225cebfe71c168a37'/>
<id>urn:sha1:81580fa06d85ef519a46b0b225cebfe71c168a37</id>
<content type='text'>
Despite POSIX states that:

&gt; The old egrep and fgrep commands are likely to be supported for many
&gt; years to come as implementation extensions, allowing historical
&gt; applications to operate unmodified.

GNU grep 3.8 started to warn[1]:

&gt; The egrep and fgrep commands, which have been deprecated since
&gt; release 2.5.3 (2007), now warn that they are obsolescent and should
&gt; be replaced by grep -E and grep -F.

Prepare for their removal in the future.

[1]: https://lists.gnu.org/archive/html/info-gnu/2022-09/msg00001.html

Signed-off-by: Đoàn Trần Công Danh &lt;congdanhqx@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t/perf: add 'GIT_PERF_USE_SCALAR' run option</title>
<updated>2022-09-02T17:02:56Z</updated>
<author>
<name>Victoria Dye</name>
<email>vdye@github.com</email>
</author>
<published>2022-09-02T15:56:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ba1b117eec2f73c84f73f827e6f3ac8b82b35585'/>
<id>urn:sha1:ba1b117eec2f73c84f73f827e6f3ac8b82b35585</id>
<content type='text'>
Add a 'GIT_PERF_USE_SCALAR' environment variable (and corresponding perf
config 'useScalar') to register a repository created with any of:

* test_perf_fresh_repo
* test_perf_default_repo
* test_perf_large_repo

as a Scalar enlistment. This is intended to allow a developer to test the
impact of Scalar on already-defined performance scenarios.

Suggested-by: Derrick Stolee &lt;derrickstolee@github.com&gt;
Signed-off-by: Victoria Dye &lt;vdye@github.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>t/perf/run: fix bin-wrappers computation</title>
<updated>2021-09-22T20:26:11Z</updated>
<author>
<name>Derrick Stolee</name>
<email>dstolee@microsoft.com</email>
</author>
<published>2021-09-21T15:46:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f9d65b04cd6bb30b2bc4afc752d3bdc17474196d'/>
<id>urn:sha1:f9d65b04cd6bb30b2bc4afc752d3bdc17474196d</id>
<content type='text'>
The GIT_TEST_INSTALLED was moved from perf-lib.sh to run in df0f5021
(perf-lib.sh: remove GIT_TEST_INSTALLED from perf-lib.sh, 2019-05-07)
and that included a change to how it inspected the existence of a
bin-wrappers directory. However, that included a typo that made the
match of bin-wrappers never work. Specifically, the assignment was

	mydir_abs_wrappers="$mydir_abs_wrappers/bin-wrappers"

which uses the same variable before it is initialized. By changing it to

	mydir_abs_wrappers="$mydir_abs/bin-wrappers"

We can correctly use the bin-wrappers directory.

This is critical to successfully computing performance of commands that
execute subcommands. The bin-wrappers ensure that the --exec-path is set
correctly.

Reported-by: Victoria Dye &lt;vdye@github.com&gt;
Signed-off-by: Derrick Stolee &lt;dstolee@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>perf: fix when running with TEST_OUTPUT_DIRECTORY</title>
<updated>2021-07-02T22:47:30Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2021-06-18T13:56:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3663e5904d7c0060f3b51ffe7c7469caeefb51e5'/>
<id>urn:sha1:3663e5904d7c0060f3b51ffe7c7469caeefb51e5</id>
<content type='text'>
When the TEST_OUTPUT_DIRECTORY is defined, then all test data will be
written in that directory instead of the default directory located in
"t/". While this works as expected for our normal tests, performance
tests fail to locate and aggregate performance data because they don't
know to handle TEST_OUTPUT_DIRECTORY correctly and always look at the
default location.

Fix the issue by adding a `--results-dir` parameter to "aggregate.perl"
which identifies the directory where results are and by making the "run"
script awake of the TEST_OUTPUT_DIRECTORY variable.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>perf-lib.sh: forbid the use of GIT_TEST_INSTALLED</title>
<updated>2019-05-08T02:00:28Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2019-05-07T10:54:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=82b7eb231d146678317fd4cf63a646c4233976e0'/>
<id>urn:sha1:82b7eb231d146678317fd4cf63a646c4233976e0</id>
<content type='text'>
As noted in preceding commits setting GIT_TEST_INSTALLED has never
been supported or documented, and as noted in an earlier t/perf/README
change to the extent that it's been documented nobody's notices that
the example hasn't worked since 3c8f12c96c ("test-lib: reorder and
include GIT-BUILD-OPTIONS a lot earlier", 2012-06-24).

We could directly support GIT_TEST_INSTALLED for invocations without
the "run" script, such as:

    GIT_TEST_INSTALLED=../../ ./p0000-perf-lib-sanity.sh
    GIT_TEST_INSTALLED=/home/avar/g/git ./p0000-perf-lib-sanity.sh

But while not having this "error" will "work", it won't write the the
resulting "test-results/*" files to the right place, and thus a
subsequent call to aggregate.perl won't work as expected.

Let's just tell the user that they need to use the "run" script,
which'll correctly deal with this and set the right
PERF_RESULTS_PREFIX.

If someone's in desperate need of bypassing "run" for whatever reason
they can trivially do so by setting "PERF_SET_GIT_TEST_INSTALLED", but
not we won't have people who expect GIT_TEST_INSTALLED to just work
wondering why their aggregation doesn't work, even though they're
running the right "git".

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
</content>
</entry>
<entry>
<title>perf tests: add "bindir" prefix to git tree test results</title>
<updated>2019-05-08T02:00:28Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2019-05-07T10:54:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fab80ee79ddf59a5d00812005bef0fa3acf5b6bf'/>
<id>urn:sha1:fab80ee79ddf59a5d00812005bef0fa3acf5b6bf</id>
<content type='text'>
Change the output file names in test-results/ to be
"test-results/bindir_&lt;munged dir&gt;" rather than just
"test-results/&lt;munged dir&gt;".

This is for consistency with the "build_" directories we have for
built revisions, i.e. "test-results/build_&lt;SHA-1&gt;".

There's no user-visible functional changes here, it just makes it
easier to see at a glance what "test-results" files are of what "type"
as they're all explicitly grouped together now, and to grep this code
to find both the run_dirs_helper() implementation and its
corresponding aggregate.perl code.

Note that we already guarantee that the rest of the
PERF_RESULTS_PREFIX is an absolute path, and since it'll start with
e.g. "/" which we munge to "_" we'll up with a readable string like
"bindir_home_avar[...]".

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
</content>
</entry>
<entry>
<title>perf-lib.sh: remove GIT_TEST_INSTALLED from perf-lib.sh</title>
<updated>2019-05-08T02:00:28Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2019-05-07T10:54:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=df0f5021951bd0ae5e7db0d89fd7e5c141c334be'/>
<id>urn:sha1:df0f5021951bd0ae5e7db0d89fd7e5c141c334be</id>
<content type='text'>
Follow-up my preceding change which fixed the immediate "./run
&lt;revisions&gt;" regression in 0baf78e7bc ("perf-lib.sh: rely on
test-lib.sh for --tee handling", 2019-03-15) and entirely get rid of
GIT_TEST_INSTALLED from perf-lib.sh (and aggregate.perl).

As noted in that change the dance we're doing with GIT_TEST_INSTALLED
perf-lib.sh isn't necessary, but there I was doing the most minimal
set of changes to quickly fix a regression.

But it's much simpler to never deal with the "GIT_TEST_INSTALLED" we
were setting in perf-lib.sh at all. Instead the run_dirs_helper() sets
the previously inferred $PERF_RESULTS_PREFIX directly.

Setting this at the callsite that's already best positioned to
exhaustively know about all the different cases we need to handle
where PERF_RESULTS_PREFIX isn't what we want already (the empty
string) makes the most sense. In one-off cases like:

    ./run ./p0000-perf-lib-sanity.sh
    ./p0000-perf-lib-sanity.sh

We'll just do the right thing because PERF_RESULTS_PREFIX will be
empty, and test-lib.sh takes care of finding where our git is.

Any refactoring of this code needs to change both the shell code and
the Perl code in aggregate.perl, because when running e.g.:

    ./run ../../ -- &lt;test&gt;

The "../../" path to a relative bindir needs to be munged to a
filename containing the results, and critically aggregate.perl does
not get passed the path to those aggregations, just "../..".

Let's fix cases where aggregate.perl would print e.g. ".." in its
report output for this, and "git" for "/home/avar/g/git", i.e. it
would always pick the last element. Now'll always print the full path
instead.

This also makes the code sturdier, e.g. you can feed "../.."  to
"./run" and then an absolute path to the aggregate.perl script, as
long as the absolute path and "../.." resolved to the same directory
printing the aggregation will work.

Also simplify the "[_*]" on the RHS of "tr -c", we're trimming
everything to "_", so we don't need that.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
</content>
</entry>
</feed>
