speedcomp: Comparing CPU times of several R expressions

Description Usage Arguments Details Value See Also Examples

View source: R/speedcomp.R

Description

This function enables comparing CPU times of several expressions. The times are calculated via system.time, additionally time ratios are calculated.

Usage

1

Arguments

...

a collection of expressions in the form of tag=value

Details

The function uses system.time to estimate CPU times needed to evaluate each of the expressions. The output provides raw timings as well as ratios of time elapsed.

The included show method prints the results nicely and additionally calculates the ratios of times elapsed.

Value

An object of S4 class speedcomp with two slots

e

list of expressions processed

timings

matrix containing the CPU times of the expressions in e estimated with system.time. Rows correspond to expressions and columns to the fields returned by system.time, i.e. "user cpu", "system cpu", "elapsed", "subproc1" and "subproc2"

See Also

system.time

Examples

1
2
3
4
5
6
# some testing of 'lm' fitting with different data sizes
e1 <- expression( lm( I(rnorm(10000)) ~ I(runif(10000)) ) )
e2 <- expression( lm( I(runif(20000)) ~ I(rnorm(20000)) ) )

# compare
speedcomp(e1, e2)

mbojan/mbtools documentation built on Nov. 9, 2017, 3:21 p.m.