atime_pkg {atime}R Documentation

Asymptotic timing package tests

Description

Computation time and memory for several R expressions of several different data sizes, for several package versions (base, HEAD, CRAN, merge-base, others specified by user).

Usage

atime_pkg(pkg.path=".", tests.dir="inst")

Arguments

pkg.path

path to git repository containing R package.

tests.dir

path to directory which contains atime/tests.R, relative to pkg.path (default "inst").

Details

There should be a tests.R code file which defines test.list, a list with names corresponding to different tests. Each element should be a list with at least three named elements: N, setup, expr, (possibly others such as pkg.edit.fun and version_name="1234567890abcdef") to be passed as named arguments to atime_versions, along with the following versions which are passed using the sha.vec argument: base ref comes from GITHUB_BASE_REF environment variable (default master), HEAD ref is the branch that you want to merge into base, CRAN is current published version (sha value ""), merge-base is most recent common ancestor commit between base and HEAD. The tests.R code file can define version.colors which should be a character vector (names for versions, values for colors; names/versions are HEAD, base, CRAN, merge-base, and any others you may define such as Before, Regression, Slow, Fixed, Fast).

Value

Named list, names come from names of test.list, and values come from results of atime_versions. Side effect is that data/plot files are saved in atime directory, including tests.RData (test results which can be read into R if you want to make your own alternative plots/analyses), and tests_all_facet.png (plot summarizing all test results).

Author(s)

Toby Dylan Hocking

See Also

atime_test for defining each test, atime_test_list for defining common arguments in each element of the test list.

Examples


if(FALSE){

  tdir <- tempfile()
  dir.create(tdir)
  git2r::clone("https://github.com/tdhock/binsegRcpp", tdir)
  repo <- git2r::repository(tdir)
  git2r::checkout(repo, "another-branch")
  result.list <- atime::atime_pkg(tdir)
  inst.atime <- file.path(tdir, "inst", "atime")
  dir(inst.atime)
  tests.RData <- file.path(inst.atime, "tests.RData")
  (objs <- load(tests.RData))

  atime::atime_versions_remove("binsegRcpp")

}

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


[Package atime version 2024.4.23 Index]