On Mon, Apr 14, 2025 at 8:51 AM Patrick Steinhardt <ps@xxxxxx> wrote: > > Wire up benchmarks in Meson. The setup is mostly the same as how we wire > up our tests. The only difference is that benchmarks get wired up via > the `benchmark()` option instead of via `test()`, which gives them a bit > of special treatment: > > - Benchmarks never run in parallel. > > - Benchmarks aren't run by default when tests are executed. > > - Meson does not inject the `MALLOC_PERTURB` environment variable. > > Using benchmarks is quite simple: > > ``` > $ meson setup build > # Run all benchmarks. > $ meson test -C build --benchmark > # Run a specific benchmark. > $ meson test -C build --benchmark p0000-* > ``` Instead of just here, I would have expected that something like this would appear towards the top of the top level meson.build file, maybe in a "Benchmarking" section, where there is the rest of the meson documentation for Git. > Other than that the usual command line arguments accepted when running > tests are also accepted when running benchmarks. > > Note that the benchmarking target is somewhat limited because it will > only run benchmarks for the current build. Other usecases, like running > benchmarks against multiple different versions of Git, are not currently > supported. Users should continue to use "t/perf/run" for those usecases. s/usecases/use cases/ > The script should get extended at one point in time to support Meson, > but this is outside of the scope of this series. Fair enough. > +if time.found() > + benchmark_environment = test_environment > + benchmark_environment.set('GTIME', time.full_path()) > + > + foreach benchmark : benchmarks > + benchmark(fs.stem(benchmark), shell, > + args: [ > + fs.name(benchmark), > + ], > + workdir: meson.current_source_dir() / 'perf', > + env: benchmark_environment, > + depends: test_dependencies + bin_wrappers, > + timeout: 0, > + ) > + endforeach > +endif I wonder what happens when we run `meson test -C build --benchmark` but 'time' is not found.