compare_functions: compare_functions

Description Usage Arguments Details Value Author(s) Examples

Description

Compare Two or more single parameter functions on execution times with multiple iterations

Usage

1
compare_functions(functions, param, increments)

Arguments

functions

A vector of single parameter functions. Do not include parameters. Only the function names.

param

A single vector, list or data.table parameter for the functions.

increments

An integer value. This is the number of different sample sizes of param to run the functions with, each with an incrementally larger size of sample.

Details

Runs the functions using random sampling of the provided parameter for different sample sizes, and returns a data table with executions times and execution rates for the different functions for different sample sizes of the parameter

Value

A data.table showing different execution times and execution rates for the functions when run with param for increments of run each with an incrementally larger size of sample.

Author(s)

Sujeet G Pillai

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
sample_function_1 <- function(arg){#Logic}
sample_function_2 <- function(arg){#Logic}
param # <A vector/list/data.table object to be passed as arg to the sample_functions>
increments # Number of times to run the functions with incrementally larger sample 
sizes of param. Eg. If size of param is 10, and increment is 3, then both functions 
will be run with 3 samples of param with sizes 1, 5 and 10 (evenly spaced out sample 
sizes)
compare_functions(functions = c(sample_function_1, sample_function_2), param = param, 
increments = increments)

## End(Not run)

sujeetp97/compare-functions documentation built on May 15, 2019, 1:39 p.m.