atime_versions: Asymptotic timing of git versions

View source: R/versions.R

atime_versionsR Documentation

Asymptotic timing of git versions

Description

Computation time and memory for a single R expression evaluated using several different git versions.

Usage

atime_versions(
pkg.path, N, setup, expr, sha.vec=NULL,
times=10, seconds.limit=0.01, verbose=FALSE,
pkg.edit.fun=pkg.edit.default, results=TRUE,
...)

Arguments

pkg.path

Path to git repo containing R package.

N

numeric vector of data sizes to vary.

setup

expression to evaluate for every data size, before timings.

expr

code with package double-colon prefix, for example Package::fun(argA, argB) which will be evaluated for each different package version.

sha.vec

named character vector / list of SHA commit IDs.

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.

results

logical, save results?

...

named SHA/commit IDs to time. Values passed as branch arg to git2r::checkout, names used to identify/interpret this version of the code in the output.

Details

First each version specified by ... is checked out and installed (to whatever R library is first on .libPaths()), using the package name Package.SHA. Then the atime function is called with arguments defined by the different SHA arguments, atime(name1=Package.SHA1::fun(argA, argB), name2=Package.SHA2::fun(argA,argB)).

Value

list of class atime with elements seconds.limit (numeric input param), timings (data table of results).

Author(s)

Toby Dylan Hocking

Examples


if(FALSE){

  tdir <- tempfile()
  dir.create(tdir)
  git2r::clone("https://github.com/tdhock/binsegRcpp", tdir)
  atime.list <- atime::atime_versions(
    pkg.path=tdir,
    N=2^seq(2, 20),
    setup={
      max.segs <- as.integer(N/2)
      data.vec <- 1:N
    },
    expr=binsegRcpp::binseg_normal(data.vec, max.segs),
    cv="908b77c411bc7f4fcbcf53759245e738ae724c3e",
    "rm unord map"="dcd0808f52b0b9858352106cc7852e36d7f5b15d",
    "mvl_construct"="5942af606641428315b0e63c7da331c4cd44c091")      
  refs.best <- atime::references_best(atime.list)
  plot(refs.best)

  atime::atime_versions_remove("binsegRcpp")

}


atime documentation built on Sept. 20, 2022, 1:06 a.m.

Related to atime_versions in atime...