bench: bench class

Description Usage Arguments Value Methods Examples

View source: R/bench.r

Description

Storage and methods benchmarking data.

Constructor for bench objects.

Usage

1
bench(header = NULL, flops = NULL)

Arguments

header

Printer header. A string or NULL to ignore.

flops

An optional numeric argument specifying the number of floating point operations for all timed operations.

Value

A bench class object.

Methods

Public methods


Method new()

Usage
benchR6$new(header = NULL, flops = NULL)
Arguments
header

Printer header. A string or NULL to ignore.

flops

An optional numeric argument specifying the number of floating point operations for all timed operations.

Details

Class initializer.


Method time()

Usage
benchR6$time(expr, reps = 1, name = NULL, env = parent.frame())
Arguments
expr

Expression to time.

reps

Number of replications for each expression.

name

Optional name for the timed expression.

env

Environment where expression will be executed.

Details

Time an expression using system.time().


Method print()

Usage
benchR6$print()
Details

Print current benchmark information.


Method table()

Usage
benchR6$table()
Details

Returns a table of the benchmark data.


Method csv()

Usage
benchR6$csv(sep = ",", header = TRUE, file = NULL)
Arguments
sep

Separator.

header

Print header?

file

A file to write to, or NULL to print to stdout.

Details

Prints the benchmark table as a csv.


Method plot()

Usage
benchR6$plot(...)
Arguments
...

Additional arguments to plot().

Details

Show a line plot of the benchmarks table.


Method barplot()

Usage
benchR6$barplot(...)
Arguments
...

Additional arguments to barplot().

Details

Show a barplot of the benchmarks table.


Method clone()

The objects of this class are cloneable with this method.

Usage
benchR6$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(merkhet)

b = bench()

b$time(Sys.sleep(.2), 2)
b
b$time(Sys.sleep(.35))
b

b$csv()

shinra-dev/merkhet documentation built on Dec. 31, 2021, 4:30 a.m.