Run a benchmark for git branches
benchmark_run(
expr_before_benchmark = {
},
...,
branches = c(branch_get_or_fail("GITHUB_BASE_REF"),
branch_get_or_fail("GITHUB_HEAD_REF")),
n = 100,
path_pkg = "."
)
Expression to run before
the benchmark is ran, will be captured with rlang::enexpr()
. So you can
use quasiquotation.
Named expression of length one with code to benchmark,
will be captured with rlang::enexprs()
. So you can use quasiquotation.
Character vector with branch names to benchmark. The package
must be built for each benchmarked branch beforehand with branch_install()
.
The base branch is the target branch of the pull request in a workflow run,
the head branch is the source branch of the pull request in a workflow run.
Number of times benchmarks should be run for each branch
. The more
iterations you run, the more narrow your confidence interval will be and
the smaller the differences you will detect. See also
vignette("inference")
. To simplify interactive experimentation with
benchmark_run()
, n
will be overridden in interactive usage after the
user calls activate(..., n = 1)
.
The path to the package to benchmark. Will be used to temporarily checkout the branch during benchmarking.
All timings in a tibble.
Runs the following loop n
times:
removes all touchstone libraries from the library path, adding the one
corresponding to branch
.
runs setup code exp_before_branch
.
benchmarks expr_to_benchmark
and writes them to disk.
This function will perform various git operations that affect the state of the directory it is ran in, in particular different branches will be checked out. Ensure a clean git working directory before invocation.