benchmark.getDTeval: benchmark.getDTeval

Description Usage Arguments Examples

View source: R/benchmark.getDTeval.R

Description

Performs a benchmarking experiment for data.table coding statements that use get() or eval() for programmatic designs. The a) original statement is compared to b) passing the original statement through getDTeval and also to c) an optimized coding statement. The results can demonstrate the overall improvement of using the coding translations offered by getDTeval()

Usage

1
2
3
4
5
6
7
benchmark.getDTeval(
  the.statement,
  times = 30,
  seed = 47,
  envir = .GlobalEnv,
  ...
)

Arguments

the.statement

refers to the original coding statement which needs to be translated to an optimized form. This value may be entered as either a character value or as an expression.

times

The number of iterations to run the benchmarking experiment

seed

an integer value specifying the seed of the pseudorandom number generator.

envir

The environment in which the calculation takes place, with the global environment .GlobalEnv set as the default.

...

provision for additonal arguments

Examples

1
2
3
4
#Benchmarking runtime performances in calculating mean age
dat<-formulaic::snack.dat
age.name<-'Age'
benchmark.getDTeval(the.statement = "dat[,.(mean_age=mean(get(age.name)))]", times = 5,  seed = 10)

Example output

                     category     Min.  1st Qu.   Median     Mean  3rd Qu.
1:        getDTeval statement 0.001785 0.001852 0.001929 0.001986 0.001936
2:  original coding statement 0.001916 0.001949 0.001985 0.002081 0.002065
3: optimized coding statement 0.001070 0.001165 0.001177 0.003646 0.001302
       Max.
1: 0.002428
2: 0.002487
3: 0.013515

getDTeval documentation built on June 21, 2021, 9:06 a.m.