Learn R Programming

atime (version 2025.4.1)

atime_test: Define an atime performance test.

Description

Use this to define an element of your test.list in atime/tests.R, prior to running atime_pkg.

Usage

atime_test(
  N, setup, expr, times, seconds.limit, verbose,
  pkg.edit.fun, result, ...)

Value

List of expressions.

Arguments

N

numeric vector of data sizes to vary.

setup

expression to evaluate for every data size, before timings. In contrast to expr, no replacement of Package: is performed.

expr

code with package double-colon prefix, for example PKG::fun(argA, argB), where PKG is the name of the package specified by pkg.path. This code will be evaluated for each different package version, by replacing PKG: by PKG.SHA:. To run different versions of implicitly-called functions like DT[i,j], you need to call them explicitly, as in data.table:::`[.data.table`(DT,i,j).

times

number of times to evaluate each timed expression.

seconds.limit

if the median timing of any expression exceeds this many seconds, then no timings for larger N are computed.

verbose

logical, print messages after every data size?

pkg.edit.fun

function called to edit package before installation, should typically replace instances of PKG with PKG.SHA, default works with Rcpp packages.

result

logical, save results? (default FALSE)

...

named versions.

Author

Toby Dylan Hocking

See Also

atime_test_list for defining common arguments in each element of the test list, atime_pkg for running tests.

Examples

Run this code

atime::atime_test(
  N=c(1,10),
  setup=data.vec <- rnorm(N),
  expr=binsegRcpp::binseg("mean_norm",data.vec))

## https://github.com/tdhock/binsegRcpp/blob/atime-test-funs/.ci/atime/tests.R
## has a real example, see how to run it in tests/testthat/test-versions.R

Run the code above in your browser using DataLab